I want to plot phase of a signal with unwrap code but when i run it, matlab shows me this error:
Error using sym/diff (line 36)
The second and third arguments must either be variables or a variable and a nonnegative integer
specifying the number of differentiations.
Error in unwrap>LocalUnwrap (line 85)
dp = diff(p,1,1); % Incremental phase variations
Error in unwrap (line 65)
q(indf,j) = LocalUnwrap(p(indf,j),cutoff);
Error in Q1 (line 40)
unwrap(phase_1)
How can I fix this problem?

 Réponse acceptée

Walter Roberson
Walter Roberson le 12 Mar 2017

0 votes

unwrap() is only defined for numeric values, not for symbolic values.

5 commentaires

phase_1 is numeric :
>> phase_1 = -atan(b_n_1,a_n_1)
phase_1 =
[ atan((100*cos(pi/25) + 25*5^(1/2) + 25)/(100*sin(pi/25) - 25*2^(1/2)*(5 - 5^(1/2))^(1/2))), atan((100*cos((2*pi)/25) - 25*5^(1/2) + 25)/(100*sin((2*pi)/25) + 25*2^(1/2)*(5^(1/2) + 5)^(1/2))) - pi, atan((100*cos((3*pi)/25) - 25*5^(1/2) + 25)/(100*sin((3*pi)/25) - 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), atan((100*cos((4*pi)/25) + 25*5^(1/2) + 25)/(100*sin((4*pi)/25) + 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi + atan((2^(1/2)*(5*5^(1/2) - 15))/(10*(5 - 5^(1/2))^(1/2))), atan((100*cos((6*pi)/25) + 25*5^(1/2) + 25)/(100*sin((6*pi)/25) - 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, atan((100*cos((7*pi)/25) - 25*5^(1/2) + 25)/(100*sin((7*pi)/25) + 25*2^(1/2)*(5^(1/2) + 5)^(1/2))) - pi, atan((100*cos((8*pi)/25) - 25*5^(1/2) + 25)/(100*sin((8*pi)/25) - 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), atan((100*cos((9*pi)/25) + 25*5^(1/2) + 25)/(100*sin((9*pi)/25) + 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi + atan((2^(1/2)*(5*5^(1/2) - 25))/(10*(5^(1/2) + 5)^(1/2))), atan((100*cos((11*pi)/25) + 25*5^(1/2) + 25)/(100*sin((11*pi)/25) - 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi + atan((100*cos((12*pi)/25) - 25*5^(1/2) + 25)/(100*sin((12*pi)/25) + 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), pi - atan((100*cos((12*pi)/25) + 25*5^(1/2) - 25)/(100*sin((12*pi)/25) - 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), atan((25*5^(1/2) - 100*cos((11*pi)/25) + 25)/(100*sin((11*pi)/25) + 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi - atan((2^(1/2)*(5*5^(1/2) + 15))/(10*(5^(1/2) + 5)^(1/2))), atan((25*5^(1/2) - 100*cos((9*pi)/25) + 25)/(100*sin((9*pi)/25) - 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi - atan((100*cos((8*pi)/25) + 25*5^(1/2) - 25)/(100*sin((8*pi)/25) + 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), -atan((100*cos((7*pi)/25) + 25*5^(1/2) - 25)/(100*sin((7*pi)/25) - 25*2^(1/2)*(5^(1/2) + 5)^(1/2))), atan((25*5^(1/2) - 100*cos((6*pi)/25) + 25)/(100*sin((6*pi)/25) + 25*2^(1/2)*(5 - 5^(1/2))^(1/2))) - pi, pi - atan((2^(1/2)*(5*5^(1/2) + 25))/(10*(5 - 5^(1/2))^(1/2)))]
Walter Roberson
Walter Roberson le 12 Mar 2017
No that is symbolic. You need to double() that to get something numeric
Ghazal Hnr
Ghazal Hnr le 12 Mar 2017
I double it, I don't have error after unwrap it but it shows me a blank page
What shows up if you do
n_phase_1 = double(phase_1);
class(n_phase_1)
size(n_phase_1)
plot(n_phase_1)
Ghazal Hnr
Ghazal Hnr le 12 Mar 2017
thank youuuu, it works

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by