To plot two signals (Signal A and Signal B) sampled at 1 kHz for 100 ms, their combination Y = A + B, and the combined signal with added white Gaussian noise (variance = 2) using subplots in MATLAB, follow the complete solution below.
fs = 1000 Hz and total time T = 0.1 s (100 ms). Create time vector t = 0:1/fs:T-1/fs (100 samples).A = sin(2*pi*50*t) and 200 Hz sine wave B = 0.7*sin(2*pi*200*t).Y = A + B.sqrt(2) ≈ 1.414): Y_noisy = Y + sqrt(2)*randn(size(t)).subplot(3,1,...) to plot individual signals, clean combined signal, and noisy signal.% Parameters fs = 1000;
% Sampling frequency: 1 kHz T = 0.1;
% Total time: 100 ms t = 0:1/fs:T-1/fs;
% Time vector (100 samples) % Signal A: Example - 50 Hz sine wave A = sin(2*pi*50*t);
% Signal B: Example - 200 Hz sine wave B = 0.7 * sin(2*pi*200*t);
% Combined signal Y = A + B Y = A + B;
% Add white Gaussian noise with variance 2 (standard deviation = sqrt(2) ≈ 1.414) noise = sqrt(2) * randn(size(t));
% White Gaussian noise with variance 2 Y_noisy = Y + noise;
% Create figure with subplots figure('Name', 'Signal Plotting', 'NumberTitle', 'off');
% Subplot 1: Original signals A and B sub
plot(3,1,1);
plot(t*1000, A, 'b', 'LineWidth', 1.5);
hold on;
plot(t*1000, B, 'r--', 'LineWidth', 1.5);
grid on;
title('Signal A (blue) and Signal B (red)');
xlabel('Time (ms)');
ylabel('Amplitude');
legend('A (50 Hz)', 'B (200 Hz)');
hold off;
% Subplot 2: Combined signal Y = A + B (clean) sub
plot(3,1,2);
plot(t*1000, Y, 'g', 'LineWidth', 1.5);
grid on;
title('Combined Signal Y = A + B (clean)');
xlabel('Time (ms)');
ylabel('Amplitude');
% Subplot 3: Combined signal Y with white Gaussian noise (variance = 2) sub
plot(3,1,3);
plot(t*1000, Y_noisy, 'k', 'LineWidth', 1.2);
grid on;
title('Signal Y with White Gaussian Noise (variance = 2)');
xlabel('Time (ms)');
ylabel('Amplitude');
% Adjust layout sg
title('Bidirectional AC-DC Converter Control Signals Simulation Example');
set(gcf, 'Position', [100 100 900 600]);Y = A + B.sqrt(2) to achieve noise variance = 2 and adds it to Y.Our 500+ PhD engineers provide verified MATLAB code, custom Simulink models, and 1-on-1 tutoring with Turnitin plagiarism reports.
Real feedback from students across top engineering universities worldwide.
“I got full marks on my MATLAB DSP assignment! The filter design code was completely vectorized, the frequency response plots were exact, and the delivery was 8 hours before my deadline. Highly recommended!”
“Our Simulink EV powertrain model had severe algebraic loop and solver errors. The MATLABSolutions team fixed the solver configuration in 4 hours and provided an annotated scope diagram. Lifesaver for my final year!”
Explore deep-dive technical articles written by our engineering team to master complex MATLAB & Simulink topics.
Why Run CNNs on Cortex-M Processors? ARM Cortex-M cores power millions of edge sensors, industrial controllers, and medical wearables. Running 1D or 2D Convolutional N...
The Memory Wall on Edge Microcontrollers Standard neural networks store weights and compute activations using single-precision floating point (32-bit float...