% disp("Results Task 4:" + newline) saveToFile = true; ssid = "wlan fahren wir noch"; beaconInterval = 100; band = 2.4; channel = 1; frameBodyConfig = wlanMACManagementConfig(BeaconInterval=beaconInterval, SSID=ssid); dsElementID = 3; dsInformation = dec2hex(channel, 2); frameBodyConfig = frameBodyConfig.addIE(dsElementID, dsInformation); beaconFrameConfig = wlanMACFrameConfig(FrameType="Beacon", ManagementConfig=frameBodyConfig, FromDS=false); [mpduBits, mpduLength] = wlanMACFrame(beaconFrameConfig, OutputFormat="bits"); fc = wlanChannelFrequency(channel, band); cfgNonHT = wlanNonHTConfig(PSDULength=mpduLength); osf = 1; tbtt = 1e-3; txWaveform = wlanWaveformGenerator(mpduBits, cfgNonHT, OversamplingFactor=osf, NumPackets=5, IdleTime=tbtt); Rs = wlanSampleRate(cfgNonHT,OversamplingFactor=osf); if saveToFile iq = txWaveform; % store to pass filepath to analyzeTrace save("traces/wlan_fahren_wir_noch_beacons.mat", "iq"); end % parameters from task1.m generatedTrace = analyzeTrace("traces/wlan_fahren_wir_noch_beacons.mat", channel, window, overlap, fft_precision, Rs); generated_p_dB_min = prctile(generatedTrace.P_dB(:), 1); generated_p_dB_max = prctile(generatedTrace.P_dB(:), 99.9); plotSpectrogram(generatedTrace, 5, generated_p_dB_min, generated_p_dB_max); %{ The first thing I noticed is that most of the spectrogram is shown in the lowest color range. This is expected, because the generated waveform is a synthetic signal and does not include receiver noise, interference, other WiFi transmissions, or non-WiFi signals. The only relevant signal components are the generated beacon frames. Between the beacons, the waveform contains idle time, so the power is close to zero and therefore appears at the lowest dB level in the spectrogram. Over time, the spectrum only changes when a beacon frame is transmitted. During these short intervals, the OFDM signal occupies the 20 MHz channel. Between the beacon frames, there is no meaningful signal energy. Since the generation is done under ideal conditions, the repeated beacons look very similar and there are no random channel effects, noise floor variations, or additional transmissions as in the recorded SDR traces. For visualization, the idle time was reduced to 1 ms and NumPackets was set to 5, so that multiple beacon frames are visible close to each other in the spectrogram. This does not represent the normal beacon interval of 100 TU (about 102.4 ms), but makes the generated frames easier to compare visually. %}