AM Demodulation code error
Mostrar comentarios más antiguos
f_lo = 30e3; % frequency of local oscillator
A_lo = 1; % amplitude of local oscillator
y_lo = A_lo*sin(2*pi*f_lo*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.
Respuestas (1)
Image Analyst
el 14 de Dic. de 2023
Editada: Image Analyst
el 14 de Dic. de 2023
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 comentarios
Matt
el 14 de Dic. de 2023
Image Analyst
el 14 de Dic. de 2023
@Matt, did you see the first two questions I asked? If you did, you forgot to tell us the answers.
And do you know how to step through code and check variable values and sizes in the workspace (i.e., normal debugging activities)?
Matt
el 14 de Dic. de 2023
Image Analyst
el 14 de Dic. de 2023
We don't know either. We don't know how you assigned them since you left it out of the snippet of code you posted. Even if we knew how you created those two variables, how do we know if it's right or not? You should know. Does it pass the sanity check, like the sizes seem reasonable to you?
I think you should know how many rows and columns your data should have, right? And if they're different then why do you think you can multiply them together?
Matt
el 14 de Dic. de 2023
Image Analyst
el 14 de Dic. de 2023
Not to me. Why would adding in that comment change anything?
Matt
el 30 de Dic. de 2023
Categorías
Más información sobre PHY Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!