How to plot this differential equation

1 次查看(过去 30 天)
Hi guys, I hope you can help me to plot this differential equation:
Y = diff(X,tau); eq = (1-alpha)/(1 - gamma*(Y - Vdr)) + alpha + beta*(Y - Vdr)^2 == F
cond = [X(0) == 0, Y(0) == 0, Vdr == 2, alpha == 0.2, beta == 0, gamma == 3]; sol = dsolve (eq,cond)
Also Y = diff(X,tau) has to be less than Vdr.
I'm completely new using matlab, so I tried to write
fplot(@(tau)sol(tau), [-5 5], '-o')
But I only got a warning message: 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.
Thanks

回答(1 个)

Kim Winter
Kim Winter 2018-7-3
Hi, You have "tau" as an input, but never initialize it before the @fplot. For example, if you try to run just line 1 (Y=diff(X,tau);), you will get the error that X is uninitialized (although tau is not either). If you initialize your inputs, you may have a better result!
-Kim

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by