changes from zurich; my mac
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
function showEQNoiseSNR(tx_signal, rx_signal, options)
|
||||
function showEQNoiseSNR(eq_signal, noise_signal, options)
|
||||
arguments
|
||||
tx_signal
|
||||
rx_signal
|
||||
eq_signal
|
||||
noise_signal
|
||||
options.fs_tx
|
||||
options.fs_rx
|
||||
options.fignum (1,1) double = NaN % Default to NaN if not provided
|
||||
@@ -16,13 +16,13 @@ end
|
||||
fig = figure(options.fignum); % Use the specified figure number
|
||||
end
|
||||
|
||||
if isa(tx_signal,'Signal')
|
||||
options.fs_tx = tx_signal.fs;
|
||||
tx_signal = tx_signal.signal;
|
||||
if isa(eq_signal,'Signal')
|
||||
options.fs_tx = eq_signal.fs;
|
||||
eq_signal = eq_signal.signal;
|
||||
end
|
||||
if isa(rx_signal,'Signal')
|
||||
options.fs_rx = rx_signal.fs;
|
||||
rx_signal = rx_signal.signal;
|
||||
if isa(noise_signal,'Signal')
|
||||
options.fs_rx = noise_signal.fs;
|
||||
noise_signal = noise_signal.signal;
|
||||
end
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ end
|
||||
% Ensure the figure is ready before calling spectrum
|
||||
title('SNR of received Signal')
|
||||
|
||||
fft_length = 2^(nextpow2(length(tx_signal))-7);
|
||||
fft_length = 2^(nextpow2(length(eq_signal))-7);
|
||||
|
||||
[s_lin,w] = pwelch(tx_signal,hanning(fft_length),fft_length/2,fft_length,options.fs_tx,"centered","psd","mean");
|
||||
[n_lin,w] = pwelch(rx_signal,hanning(fft_length),fft_length/2,fft_length,options.fs_rx,"centered","psd","mean");
|
||||
[s_lin,w] = pwelch(eq_signal,hanning(fft_length),fft_length/2,fft_length,options.fs_tx,"centered","psd","mean");
|
||||
[n_lin,w] = pwelch(noise_signal,hanning(fft_length),fft_length/2,fft_length,options.fs_rx,"centered","psd","mean");
|
||||
|
||||
w = w.*1e-9;
|
||||
snr_dbm = 10*log10(s_lin./n_lin);
|
||||
@@ -48,6 +48,7 @@ end
|
||||
% figure(231)
|
||||
hold on
|
||||
plot(w,snr_dbm,'DisplayName','SNR','LineWidth',0.5,'Color',options.color);
|
||||
yline(mean(snr_dbm),'HandleVisibility','off','Color',options.color);
|
||||
xlabel("Frequency in GHz");
|
||||
|
||||
edgetick = 2^(nextpow2(options.fs_tx*1e-9));
|
||||
|
||||
Reference in New Issue
Block a user