close all;
clear all;
clc;
t = 0:0.000001:0.01; % 0ms < t < 10ms in 1uS increments
% 1. 10V Amplitude 1000 Hz Sine Save
A1 = 10; %10V Amplictude
f1 = 1000; %frequency in Hz
%t1 = 0:0.000001:0.001;
S1 = A1*sin(2*pi*f1*t); %sine wave
plot(t,S1);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('10V Amplitude 1000 Hz Sine Wave');
grid on;
% 2. 15V Amplitude 1200 Hz Cosine Save
A2 = 15; %15V Amplictude
f2 = 1200; %frequency in Hz
S2 = A2*sin(2*pi*f2*t); %Cosine wave
plot(t,S2);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('15V Amplitude 1200 Hz Sine Wave');
grid on;
% 3a. Add S1 and S2
S3 = S1+S2;
plot(t,S3);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S1 + S2 Plot');
grid on;
% 3b. Subtract S1 from S2
S4 = S2-S1;
plot(t,S3);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S2 - S1 Plot');
grid on;
% 3c. Multiply S1 by S2
S5 = S1*S2;
plot(t,S5);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S1 X S2 Plot');
grid on;
Here Are my results for each waveform:



Could someone explain why this one doesn't work?
clear all;
clc;
t = 0:0.000001:0.01; % 0ms < t < 10ms in 1uS increments
% 1. 10V Amplitude 1000 Hz Sine Save
A1 = 10; %10V Amplictude
f1 = 1000; %frequency in Hz
%t1 = 0:0.000001:0.001;
S1 = A1*sin(2*pi*f1*t); %sine wave
plot(t,S1);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('10V Amplitude 1000 Hz Sine Wave');
grid on;
% 2. 15V Amplitude 1200 Hz Cosine Save
A2 = 15; %15V Amplictude
f2 = 1200; %frequency in Hz
S2 = A2*sin(2*pi*f2*t); %Cosine wave
plot(t,S2);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('15V Amplitude 1200 Hz Sine Wave');
grid on;
% 3a. Add S1 and S2
S3 = S1+S2;
plot(t,S3);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S1 + S2 Plot');
grid on;
% 3b. Subtract S1 from S2
S4 = S2-S1;
plot(t,S3);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S2 - S1 Plot');
grid on;
% 3c. Multiply S1 by S2
S5 = S1*S2;
plot(t,S5);
xlabel('Time (ms)');
ylabel('Amplitude (V)');
title('S1 X S2 Plot');
grid on;
Here Are my results for each waveform:



Could someone explain why this one doesn't work?
