I have some expressions, I dont know the different between using function 'subs' and calculating directly. My purpose is calculate nuy, by substitute the varience 'rch' into 'atan(f./(2*pi*x))' .
When I use 'subs' function, it results the error, division by zero.
But when I calculate directly, there are not error, and I obtained the result? Could anyone explain me about this?
>> syms x
>> nuy = atan(f./(2*pi*x));
>> rch = 0:0.001:0.3603;
>> subs(nuy,x,rch);
Error using symengine Division by zero.
Error in sym/subs>mupadsubs (line 140) G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 125) G = mupadsubs(F,X,Y);
nuy = atan(f./(2*pi*rch));

 채택된 답변

Stephen23
Stephen23 2017년 3월 23일
편집: Stephen23 2017년 3월 23일

1 개 추천

If you are using R2013A or newer then use atan2 instead:
>> syms x
>> nuy = atan2(f,2*pi*x);
>> rch = 0:0.001:0.3603;
>> subs(nuy,x,rch)

댓글 수: 4

duong mai
duong mai 2017년 3월 23일
Ah, my f equals to 0.02, it is not a function. that is ' 0.02/(2*pi*x) '. I mean why it does not happen error when i calculate directly?
Stephen23
Stephen23 2017년 3월 23일
편집: Stephen23 2017년 3월 23일
>> f = 0.02;
>> syms x
>> nuy = atan(f./(2*pi*x));
>> rch = 0:0.001:0.3603;
>> subs(nuy,x,rch)
ans =
1.5708 1.2664 1.0098 0.815 0.67216 0.56691 0.48776 etc
duong mai
duong mai 2017년 3월 23일
편집: duong mai 2017년 3월 23일
There appears error. My screen does not look like yours. Why?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series Events에 대해 자세히 알아보기

태그

질문:

2017년 3월 23일

편집:

2017년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by