Clear Filters
Clear Filters

How to plot this differential equation

1 view (last 30 days)
Carlos Castañeda
Carlos Castañeda on 4 Jun 2018
Answered: Kim Winter on 3 Jul 2018
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

Answers (1)

Kim Winter
Kim Winter on 3 Jul 2018
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

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!