In: Computer Science
Matlab
Theoretical Calculations:
t = (-.00025: .00025: 100000);
A1 = 29;
A2 = 1.2*A1;
t1 = (37.2/2)*.00025;
t2 = -(41.3/10)*.00025;
x1 = A1*co(2*pi*(4000)*(t-t1));
x2 = A2*co(2*pi*(4000)*(t-t2));
x3 = x1 + x2;
Remember that the phase of a sinusoid can be calculated after measuring the time location of a positive peak,3 if we know the frequency.
(a) Make measurements of the “time-location of a positive peak” and the amplitude from the plots of x1(t) and x2(t), and write those values for Ai and ti directly on the plots. Then calculate (by hand) the phases of the two signals, x1(t) and x2(t), by converting each time-shift ti to phase. Note: when doing computations, express phase angles in radians, not degrees!
(b) Measure the amplitude and time-shift of x3(t) directly from the plot and then calculate the phase φ3 by hand. In your report, show how the amplitude and time-shift were measured, and how the phase was calculated.
(c) Now use the phasor addition theorem. Carry out a phasor addition of complex amplitudes for x1(t) and x2(t) to determine the complex amplitude for x3(t). Use the complex amplitude for x3(t) to verify that your previous calculations of A3 and φ3 were correct.
Program code screen shot:
Sample Output:
When lower output: A = 1:
Sample Output: A = 29;
Note : Here, Input value is too large, that's why it's not compile proper and did get the result proper.
Give small input then it work proprly.
Given input
x1 = A1*co(2*pi*(4000)*(t-t1));
x2 = A2*co(2*pi*(4000)*(t-t2)); is wrong, here Co means cos. Correction..
Program code to copy:
%% clear screen
clc
%% clase all the previous program
close all
% declare the given input value.
A1 = 29;
A2 = 1.2*A1;
t1=(37.2/2)*.00025;
t2=-(41.3/10)*.00025;
%% declare the frequency
%% measuring the time location of a
%% positive peak
fm=4000;
fs=20*fm;
%% time-location of a positive peak”
Ts=1/fs;
%% given time
t = (-.00025: .00025: 100000);
%% x1 andx2 value compute by the function
%% given
x1=A1*cos(2*pi*(4000)*(t-t1));
x2=A2*cos(2*pi*(4000)*(t-t2));
%% (a) Make measurements of the “time-location of a
%%positive peak” and the amplitude from the plots of x1(t)
%%and x2(t), and write those values for Ai and ti
%%directly on the plots.
figure(1);subplot(3,1,1);plot(t,x1,'b');
%% x label and y label amplitude
xlabel('\it t \amplitude');
ylabel('\it x_1(t) \amplitude Phase');
%% (b) Measure the amplitude and time-shift of x3(t)
%%directly from the plot and then calculate the
%%phase φ3 by hand. In your report, show how the
%%amplitude and time-shift were measured, and how the
%%phase was calculated.
subplot(3,1,2);plot(t,x2,'r');
xlabel('\it t \phase');
ylabel('\it x_2(t) \phase');
%% x3 given value
x3=x1+x2;
%%(c) Now use the phasor addition theorem. Carry out a
%%phasor addition of complex amplitudes for x1(t) and x2(t) to
determine
%%the complex amplitude for x3(t). Use the complex amplitude
for
%%x3(t) to verify that your
%%previous calculations of A3 and φ3 were correct.
subplot(3,1,3);plot(t,x3,'m');
xlabel('\it t \amplitude ');
ylabel('\it x_3(t) \amplitude');