필터 지우기
필터 지우기

Wrong final answer using symbolic equations

조회 수: 1 (최근 30일)
Diana Dawoud
Diana Dawoud 2022년 1월 7일
댓글: David Goodmanson 2022년 1월 7일
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에서 Assumptions에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by