Effacer les filtres
Effacer les filtres

Wrong final answer using symbolic equations

1 vue (au cours des 30 derniers jours)
Diana Dawoud
Diana Dawoud le 7 Jan 2022
I'm trying to write this simple code, the right answer is 0.3 with an angle of 143.13, the answer that I'm getting is 0.5 with an angle of 90.76, any reason why I'm getting the wrong answer
syms C w R
V=150*exp(1i*pi/2)
Xc= 1/(1i*w*C)
Z=R+Xc
z=subs(Z,[C w R],[0.25*10^(-6) 10^4 300])
I=V./z
  1 commentaire
David Goodmanson
David Goodmanson le 7 Jan 2022
Hello Diana,
I ran the code, followed by
Im = double(abs(I))
Ia = double(angled(I))
and got the answer you were expecting. Hard to say what might have gone wrong.
By the way for a problem like this there is no need to use symbolic variables, only to immediately substitute in values. It's easier to not bother and start out with C = 0.25*10^(-6), w = 10^4 etc.

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by