Error using plot Data must be numeric, datetime, duration or an array convertible to double.
Mostrar comentarios más antiguos
>> clear all
>> close all
>> syms s
>> F = (2*s+1)/(s^3 +3*s^2+4*s+2)
F =
(2*s + 1)/(s^3 + 3*s^2 + 4*s + 2)
>> t = [0:0.1:200];
>> f = ilaplace(F)
f =
exp(-t)*(cos(t) + 2*sin(t)) - exp(-t)
>> plot(t,f)
Error using plot
Data must be numeric, datetime, duration or an array
convertible to double.
I'm getting an error for my code and my teacher isn't sure what the issue is. I am able to plot smaller parts of this function but not the whole this. From what I understand from other posts it seems like the issue may be a symbolic variable or how this is defined? Any answers?
Respuesta aceptada
Más respuestas (1)
syms s T
F = (2*s+1)/(s^3 +3*s^2+4*s+2)
t = 0:0.1:200;
f = ilaplace(F, s, T)
y = double(subs(f, T, t));
plot(t, y)
title('0:0.1:200')
%or
figure
fplot(f, [0 100], 'meshdensity', 27)
title('fplot[0,10]')
The default meshdensity is 23. If you do not use the option with at least 27 you will get the wrong plot. 26 will get a plot that almost looks right unless you change the ylim.
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



