% Parameters reclen = 133169152; Scp_long = ScopeKeysight("model","DSAZ634A",'autoscale',0,"fadc","GSa_160","channel",[0,0,1,0],"recordLen",reclen,"removeDC",1,"extRef",1); Scpe_sig_raw = Scp_long.read("channel",[0,0,1,0]); Scpe_sig_raw = Scpe_sig_raw{3}; signal = Scpe_sig_raw.signal; Fs = Scpe_sig_raw.fs; % Sampling rate [Hz] N = length(signal); % Number of samples f_center = 20e9; % Frequency of interest (~20 GHz) % Create time vector t = (0:N-1)' / Fs; % Mix down to baseband signal_mix = signal .* exp(-1j * 2 * pi * f_center * t); % Low-pass filter (optional but recommended) % Design a filter with bandwidth ~ linewidth * safety margin BW = 1000e6; % 100 MHz bandwidth for example % Decimate (reduce sampling rate) decimation_factor = 10;%floor(Fs / (2 * BW)); signal_decim = downsample(signal_mix, decimation_factor); Fs_decim = Fs / decimation_factor; % FFT of downmixed signal Nfft = 2^nextpow2(length(signal_decim) * 4); % Zero-pad spectrum = fft(signal_decim .* blackmanharris(length(signal_decim)), Nfft); freq = (0:Nfft-1) * (Fs_decim / Nfft); % Only positive frequencies halfIdx = 1:floor(Nfft/2); spectrum_half = abs(spectrum(halfIdx)); freq_half = freq(halfIdx); % Plot figure; plot(freq_half / 1e6, 20*log10(spectrum_half)); xlabel('Frequency (MHz)'); ylabel('Magnitude (dB)'); title('Zoomed Spectrum around 20 GHz'); grid on;