problem in drawing the frequency spectrum of frequency modulated signal in matlab
조회 수: 3 (최근 30일)
이전 댓글 표시
here is the coding, the output of the frequency spectrum has no value... the error is
Index exceeds the number of array elements. Index must not exceed 1001.
Error in frequency_modulation (line 39)
plot(f(9500:10500),Vfm_f(9500:10500));
can anyone check? thank you so much.
fs=100000; %sampling frequency
ts = 1/fs ; % time interval between sample point
t = 0 : ts :0.02; % scale of time, maximun=0.02
N= size(t,2);
fm=100;
Vm=2*sin(2*pi*100*t);
fc=10000;
Vc=10*cos(2*pi*10000*t);
Vfm= 10*cos(2*pi*fc*t + 2*sin(2*pi*fm*t)); %modulated signal= Vfm
subplot(4,1,1);
plot(t,Vc);
ylabel('Amplitude (V)');
xlabel('Time(s)');
title('Carrier Signal Time Domain Representation');
grid on;
subplot(4,1,2);
plot(t,Vm);
ylabel('Amplitube (V)');
xlabel('Time (s)');
title('Message signal Time Domain Representation');
grid on;
subplot(4,1,3);
plot(t,Vfm);
ylabel('Amplitube (V)');
xlabel('Time (s)');
title('Frequency Modulated Signal Time Domain Representation');
grid on;
f=fs*(0:N/2)/N;
Vfm_f = (2/N)*abs(fft(Vfm,N));
subplot(4,1,4);
plot(f(9500:10500),Vfm_f(9500:10500));
ylabel('Amplitube (V)');
xlabel('Frequency(Hz)');
title('Frequency Modulated Signal Frequency Representation');
grid on;
댓글 수: 0
채택된 답변
Chunru
2021년 12월 11일
fs=100000; %sampling frequency
ts = 1/fs ; % time interval between sample point
t = 0 : ts :0.02; % scale of time, maximun=0.02
N= size(t,2);
fm=100;
Vm=2*sin(2*pi*100*t);
fc=10000;
Vc=10*cos(2*pi*10000*t);
Vfm= 10*cos(2*pi*fc*t + 2*sin(2*pi*fm*t)); %modulated signal= Vfm
subplot(4,1,1);
plot(t,Vc);
ylabel('Amplitude (V)');
xlabel('Time(s)');
title('Carrier Signal Time Domain Representation');
grid on;
subplot(4,1,2);
plot(t,Vm);
ylabel('Amplitube (V)');
xlabel('Time (s)');
title('Message signal Time Domain Representation');
grid on;
subplot(4,1,3);
plot(t,Vfm);
ylabel('Amplitube (V)');
xlabel('Time (s)');
title('Frequency Modulated Signal Time Domain Representation');
grid on;
f=fs*(0:N/2)/N;
Vfm_f = (2/N)*abs(fft(Vfm,N));
Vfm_f=Vfm_f(1:floor(N/2)+1); % take the half: positive frequency
subplot(4,1,4);
plot(f,Vfm_f);
xlim([5000 15000])
ylabel('Amplitube (V)');
xlabel('Frequency(Hz)');
title('Frequency Modulated Signal Frequency Representation');
grid on;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!