Borrar filtros
Borrar filtros

Wrong final answer using symbolic equations

1 visualización (últimos 30 días)
Diana Dawoud
Diana Dawoud el 7 de En. de 2022
Comentada: David Goodmanson el 7 de En. de 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 comentario
David Goodmanson
David Goodmanson el 7 de En. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by