error using plot data must be numeric, datetime, duration or an array convertible to double

2 次查看(过去 30 天)
WHY IT GIVE ME AN ERROR???
t=[0:0.1:50]
syms s
gs=1/(s^2 + 5*s + 6);
roots([1 5 6])
gjw=fourier(gs)
plot(t,gjw)

采纳的回答

Steven Lord
Steven Lord 2022-2-10
Let's see what you're trying to plot.
t=[0:0.1:50]
t = 1×501
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 1.9000 2.0000 2.1000 2.2000 2.3000 2.4000 2.5000 2.6000 2.7000 2.8000 2.9000
syms s
gs=1/(s^2 + 5*s + 6);
roots([1 5 6]);
gjw=fourier(gs)
gjw = 
If you want to evaluate gjw for w equal to each of the elements in t you can do this, and then you can plot the result.
syms w
gjw_at_t = subs(gjw, w, t);
plot(t, gjw_at_t)
Warning: Imaginary parts of complex X and/or Y arguments ignored.
You might want to plot the real and imaginary parts of gjw_at_t separately.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Formula Manipulation and Simplification 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by