Error using ezplot on differential equation

6 vues (au cours des 30 derniers jours)
Marek Polacek
Marek Polacek le 19 Déc 2019
Commenté : Star Strider le 19 Déc 2019
Hi. Can anyone please tell me what's wrong with this code?
syms ya yb y xb t
ya = dsolve('(L*10^(-3))/(Rs*10^3)*D2ya+Dya+1/(Rs*10^3+C*10^(-6))*ya=0','ya(0)=5','Dya(0)=2');
figure(1)
ezplot(ya,[0,10])
grid on
axis auto
It displays this error message:
Error using sym/ezplot (line 50)
Two variables or less expected when plotting an equation.
Error in soustava (line 14)
ezplot(ya,[0,10])
This code is crucial for me to get working, otherwise I fail my subject. Why it works with older version and R2019a doesn't accept it?

Réponses (1)

Star Strider
Star Strider le 19 Déc 2019
Provide the correct numerical values for ‘C’, ‘L’, and ‘Rs’ if you want to plot it:
syms C L Rs ya(t) yb y xb t
C = sym(3);
L = sym(5);
Rs = sym(7);
Dya = diff(ya);
D2ya = diff(Dya);
ya = dsolve((L*10^(-3))/(Rs*10^3)*D2ya+Dya+1/(Rs*10^3+C*10^(-6))*ya==0,ya(0)==5,Dya(0)==2)
figure(1)
ezplot(ya,[0,10])
grid on
axis auto
  10 commentaires
Marek Polacek
Marek Polacek le 19 Déc 2019
The intended function was actually a filter. It's not a linear function. This is how it should look like:
function_correct.jpg
This is how it actually looks:
function_actual.jpg
I don't think that it should be linear function (or in this case, pretty much constant, when considering those tenthousanths decrements). Look at the top plot - it shows nice band pass filter. Look at the bottom plot - it shows straight line going in super small decrements. The values are also incorrect. The function should be much below the value of 1 (the top is actually decibel range, so it is in logarithmic scale)...
Star Strider
Star Strider le 19 Déc 2019
Please note that your differential equation (and of course its solution) are in the time domain and the Bode plot is in the frequency domain. They should not look at all the same.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by