Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This first project allows you to get familiar with Matlab by writing some code d

ID: 1715050 • Letter: T

Question

This first project allows you to get familiar with Matlab by writing some code developing signals that we will be using. The code is listed for a specific example and then you try it with different parameters. Creating a Discrete-Time Sequence. Matlab is based on linear math. The most convenient way to present a sequence in Matlab is with a vector. First, create a vector based on time and your sampling interval. The above command defines a vector "t" that contains values from 0 to 1 in increments of 0.1, your sampling interval. Now you may multiply this vector by any function and create a new discrete-time vector. Experiment with cosine and sawtooth period signals. Vary your Amplitude, frequency, and phase shift. Change your sampling interval and limits. Step and impulse Functions. Matlab has a ones(M, N) and zeros(M, N) commands to allow filling a matrix with one value. This is for the range -1 to 1. How do the sequences change for {n+10} and u(n-20). Addition and Multiplication of Sequences. For addition in Matlab, you only need to add the two vectors together though they must be the same size. When doing multiplication, Matlab tries to perform matrix multiplication. For sequence multiplication, we only want component with common index to be multiplied To do this in Matlab, precede the * with a period.

Explanation / Answer

1.Desired values should be given for frequency(f0), amplitude(ampl), phase (phi) in the following code.

1.1) code for sine wavw.

%plotting a sine wave.
t=0:0.001:1; %time
f0=60; %enter desired frequency
ampl=1; %enter desired amplitude
phi=pi/3; %enter desired phse shift
w0=2*pi*f0; %frequency in radians
sin_out=ampl*sin(t*w0+phi);
plot(t,sin_out);

1.2) %plotting a cosine wave.
t=0:0.001:1; %time
f0=60; %enter desired frequency
ampl=1; %enter desired amplitude
phi=pi/3; %enter desired phse shift
w0=2*pi*f0; %frequency in radians
cos_out=ampl*cos(t*w0+phi);
plot(t,cos_out);

1.3) %plotting a sawtooth wave.
t=0:0.001:1; %time
f0=60; %enter desired frequency
ampl=1; %enter desired amplitude
phi=pi/3; %enter desired phse shift
w0=2*pi*f0; %frequency in radians
saw_out=ampl*sawtooth(t*w0+phi);
plot(t,saw_out);

-----------------------------------------------------------------------------------------

2) %Plotting impulse{n+10} and unit step[n-20]
t=-30:1:30;
n=t;
delta=[zeros(1,20),1,zeros(1,40)];
unit=[zeros(1,51),ones(1,10)];
plot(n,delta,'ko');
axis([-30 30 0 1.2]);
hold all;
plot(n,unit,'ko');
hold all;

-----------------------------------------------------------------------------------------

3)%Plotting exp(t)
t=-1:0.01:1;
a=exp(t);
b=[zeros(1,100),ones(1,101)];
out=a.*b;
plot(t,out,'ko');
hold all;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote