필터 지우기
필터 지우기

AM Demodulation code error

조회 수: 1 (최근 30일)
Matt
Matt 2023년 12월 14일
댓글: Matt 2023년 12월 30일
f_lo = 30e3; % frequency of local oscillator
A_lo = 1; % amplitude of local oscillator
y_lo = A_lo*sin(2*pi*f_lo*time');
Unrecognized function or variable 'time'.
y_demod = y_lo.*filt_received';
demod_sig_FD = fft(y_demod); % calculate frequency domain of audio
demod_sig_FD_amp = abs(demod_sig_FD)/no_of_pnts; % calculate the amplitude of frequency domain
demod_sig_FD_amp_adj = fftshift(demod_sig_FD_amp); % adjust the frequency sides
figure;
semilogy(freq, filt_rec_sig_FD_amp_adj, 'b');
hold on;
semilogy(freq, demod_sig_FD_amp_adj, 'r');
xlim([10, freq_max]);
grid minor;
box on;
xlabel('Frequency (Hz)');
ylabel('Amplitude');
legend('Filtered Received', 'Demodulated');
title('Frequency Domain of Filtered Received and Demodulated Signals');
The Error is:
y_demod = y_lo.*filt_received';
Requested 1102840x20000 (164.3GB) array exceeds maximum array size preference (7.7GB). This might cause MATLAB to become unresponsive.

답변 (1개)

Image Analyst
Image Analyst 2023년 12월 14일
편집: Image Analyst 2023년 12월 14일
time is a built in function so your use of it is not recommended.
What is filt_received? Specifically what is its size (rows and columns)? If it's a vector, or you think it is, then it might not be the same shape as y_lo. Then with the "automatic expansion" it's making a huge 2-D matrix out of it. You might try turning both factors into column vectors and then doing it.
y_demod = y_lo(:) .* filt_received(:); % Create new column vector.
These are just normal questions that any of the rest of us would ask when debugging code. To learn how to debug: Debugging in MATLAB | Doug's MATLAB Video Tutorials
  댓글 수: 7
Image Analyst
Image Analyst 2023년 12월 14일
Not to me. Why would adding in that comment change anything?
Matt
Matt 2023년 12월 30일
time has originated from my carrier signal code:
mod_ind = 1; % AM modulation index
f_carrier = 550e3; % frequency of carrier sine wave
A_carrier = std(audio)/mod_ind; % amplitude of carrier sine wave
y_carrier = A_carrier*sin(2*pi*f_carrier*time');
carrier_FD = fft(y_carrier); % calculate frequency domain of audio
carrier_FD_amp = abs(carrier_FD)/no_of_pnts; % calculate the amplitude of frequency domain
carrier_FD_amp_adj = fftshift(carrier_FD_amp); % adjust the frequency sides

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

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by