Wrong final answer using symbolic equations

2 次查看(过去 30 天)
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 个评论
David Goodmanson
David Goodmanson 2022-1-7
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by