필터 지우기
필터 지우기

Unable to convert expression into double array.

조회 수: 2 (최근 30일)
Pablo Álvarez García
Pablo Álvarez García 2022년 2월 12일
답변: Prachi Kulkarni 2022년 2월 15일
%¿COMO PUEDO DIBUJAR LA PARTE REAL E IMAGINARIA?
syms z w
Gz=z^2/(2*z-5);
Gjw=subs(Gz,z,j*w);
n=0:1:25
figure(1)
mod=abs(Gjw)%grafica la parte real
subplot(2,1,1)
stem(n,mod)
xlabel('frec (Hz)')
ylabel('MÓDULO')
phase=imag(Gjw) %grafica la parte imag
subplot(2,1,2)
stem(n,phase)
xlabel('frec (Hz)')
ylabel('ARGUMENTO')
sgtitle('G(jw)')

채택된 답변

Prachi Kulkarni
Prachi Kulkarni 2022년 2월 15일
Hi,
You haven’t substituted the symbol w with any value. That is why the substitution cannot generate a numeric value. Small changes to your code as shown below can solve the issue.
syms z w % w should not be variable
w = 0:1:25; % assigning some values to w of the same size as n
Gz=z^2/(2*z-5);
Gjw=double(subs(Gz,z,j*w)); % convert sym to double
n=0:1:25
figure(1)
mod=abs(Gjw)%grafica la parte real
subplot(2,1,1)
stem(n,mod)
xlabel('frec (Hz)')
ylabel('MÓDULO')
phase=imag(Gjw) %grafica la parte imag
subplot(2,1,2)
stem(n,phase)
xlabel('frec (Hz)')
ylabel('ARGUMENTO')
sgtitle('G(jw)')

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!