绘制分段符号函数
Plot piecewise symbolic function
所以,这是我的脚本:
syms t r w
x1=5^-t*heaviside(t);
x_2=subs(x1,t,t-r);
x2=conj(x_2);
R=int(x1*x2,t,-inf,inf);
R=simplify(R)
ezplot(R, [-10 10]);
R=piecewise([0 <= r, 1/5^r/(2*log(5))], [r <= 0, 5^r/(2*log(5))])
如您所见,我正在尝试使用 ezplot
函数绘制符号解,但出现此错误:
The input string must be an expression. Implicit functions of a single variable are not supported.
据我了解,matlab 不适用于分段函数。还有其他方法可以绘制此函数吗?
我采用了用不等式重写分段表达式的方法:
ezplot(@(r)(0 <= r)*1/5^r/(2*log(5)) + (r <= 0)*5^r/(2*log(5)));
复制粘贴不太理想,但总比没有好。
或者你可以用数字来计算:
x = -10:0.01:10;
y = eval(subs(R,r,x));
plot(x,y)
所以,这是我的脚本:
syms t r w
x1=5^-t*heaviside(t);
x_2=subs(x1,t,t-r);
x2=conj(x_2);
R=int(x1*x2,t,-inf,inf);
R=simplify(R)
ezplot(R, [-10 10]);
R=piecewise([0 <= r, 1/5^r/(2*log(5))], [r <= 0, 5^r/(2*log(5))])
如您所见,我正在尝试使用 ezplot
函数绘制符号解,但出现此错误:
The input string must be an expression. Implicit functions of a single variable are not supported.
据我了解,matlab 不适用于分段函数。还有其他方法可以绘制此函数吗?
我采用了用不等式重写分段表达式的方法:
ezplot(@(r)(0 <= r)*1/5^r/(2*log(5)) + (r <= 0)*5^r/(2*log(5)));
复制粘贴不太理想,但总比没有好。
或者你可以用数字来计算:
x = -10:0.01:10;
y = eval(subs(R,r,x));
plot(x,y)