Filter löschen
Filter löschen

Plotting a result from dsolve

29 Ansichten (letzte 30 Tage)
Sergio Manzetti
Sergio Manzetti am 8 Aug. 2017
Kommentiert: Shantanu Gupta am 6 Jan. 2021
Hi, I'd like to add a plotting command for the result of
syms h g
h = 1
g = 4
dsolve('h^2*(D2v)+2*i*g*h*Dv-g^2=0','v(0)=x')
How can this be done?
Thanks

Akzeptierte Antwort

Elizabeth Reese
Elizabeth Reese am 10 Aug. 2017
I am not sure what x is in this case, but you should be able to use fplot or fplot3 to plot the function. You may need to constrain it some more to eliminate the constant terms or define what x should be, but those are the functions that can take the output of dsolve and plot it. I have made a little example below based on the dsolve documentation example.
syms y(t) a b;
a = 1; b = 4;
eqn = diff(y,t,2) == a^2*y;
Dy = diff(y,t);
cond = [y(0)==b, Dy(0)==1];
ySol(t) = dsolve(eqn,cond);
fplot(ySol);
  1 Kommentar
Shantanu Gupta
Shantanu Gupta am 6 Jan. 2021
Is it possible to put the condition latter? How to plot in that case.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by