Azzera filtri
Azzera filtri

Wrong final answer using symbolic equations

1 visualizzazione (ultimi 30 giorni)
Diana Dawoud
Diana Dawoud il 7 Gen 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 Commento
David Goodmanson
David Goodmanson il 7 Gen 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.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by