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

3 visualizzazioni (ultimi 30 giorni)
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);
^

Risposta accettata

Walter Roberson
Walter Roberson il 7 Mar 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]);

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by