I am trying to graph a function over time, but im struggling to code this.

3 Ansichten (letzte 30 Tage)
This is the code i am using
g = 2.4*exp(-t)-2.4*cos(2*t)+4.4*sin(2*t)+10*t*cos(2*t)+72*t*sin(2*t);
fplot(g,[0,10]);
This is the error message
Error in Problem_4_Ans (line 4)
g = 2.4*exp(-t)-2.4*cos(2*t)+4.4*sin(2*t)+10*t*cos(2*t)+72*t*sin(2*t);
^

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Mär. 2025
Two different approaches:
g = @(t) 2.4*exp(-t)-2.4*cos(2*t)+4.4*sin(2*t)+10*t*cos(2*t)+72*t*sin(2*t);
fplot(g,[0,10]);
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
syms t
g = 2.4*exp(-t)-2.4*cos(2*t)+4.4*sin(2*t)+10*t*cos(2*t)+72*t*sin(2*t);
fplot(g,[0,10]);

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by