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

Define a vector t from-1 to 1 with step size -001. the following functions as fu

ID: 3184046 • Letter: D

Question

Define a vector t from-1 to 1 with step size -001. the following functions as functions (they are all defined in the same file). J1(t) = cos(40nt) [sin(4mt) +21 92 = e-2t cos(107t) ()At) = sin(4m) a(t) = cos(201t) + cos(22nt). a(t) = 4 t plot the gi(t), 92(t)9s(t), and g4(t) on the same figure window using subplot. Break the Figure window into a 2-by-2 matrix of small axes. gn (t) should occupy position 1, 92(t) should position 2, 9s(t) should occupy position 3, ga(t) should position 4 Use xlim to set the limit of the x-axis to [-1 1] ylim to set the y-axis limit of gi(t) to [-3 3] ylim to set the y-axis limit of 92(t) to [-10 10 ylim to set the y-axis limit of 9s(t) to [-0.5 1.2] ylim to set the y-axis limit of 92(t) to [-2.2 2.2] Label x-axis as time and each y-axis as as the corresponding function.

Explanation / Answer

Hi,

Please copy the below code to matlab editor for better vision and understanding. Comments start with %% will help to interpret the code.

Note: In the last but second part of the question it is mentioned that use ylim to set y-axis limit of g2(t) to [-2.2 2.2]. I thought like it should be for g4(t) as it has been already asked for g2(t) to [-10,10]. Please be noted.

%%%%%%%%%%%%%CODE STARTS HERE%%%%%%%%%%%%%%

clc;

clear all;
t = linspace(-1,1,201); %% defines a vector t from -1 to 1 with step size 0.01

%% as the given step size is 0.01, the values of vector t must be -1, -0.99, -0.98,......,0.98,0.99,1
%% the total number of values of t will be 201.
%% linspace(-1,1,201) means sequence of 201 values starting from -1 to 1, which gives the desired vectoor t.

fprintf(' ******************************* The values of vector t are as below ******************************* ');
disp(t); %% displays the values of the vector t


for i=1:1:201 %% for loop will iterate for 201 times as required
  
a(i)=t(i); %% assigning each value of vector to a local variable for each iteration of for loop
  
%% calculation of all the functions
g1(i) = cos(4*pi*t(i))*(sin(4*pi*t(i))+2);
g2(i) = exp(-2*t(i))*cos(10*pi*t(i));
g3(i) = sin(4*pi*t(i))/(4*pi*t(i));
g4(i) = cos(20*pi*t(i))+cos(22*pi*t(i));

%%first subplot
subplot(2,2,1)
plot(a,g1);%% plots the subgraph 1
xlim([-1,1]); %% sets x-axis to [-1,1]
ylim([-3,3]); %% sets y-axis of g1(t) to [-3,3]
title('Subplot 1: g1(t)') %% title of the subplot
xlabel('time'); %X-label
ylabel('g1(t)'); %Y-label
  
%%second subplot
subplot(2,2,2)
plot(a,g2); %% plots the subgraph 2
xlim([-1,1]); %% sets x-axis to [-1,1]
ylim([-10,10]); %% sets y-axis of g1(t) to [-10,10]
title('Subplot 2: g2(t)') %% title of the subplot
xlabel('time'); %X-label
ylabel('g2(t)'); %Y-label

%%Third subplot
subplot(2,2,3)
plot(a,g3); %% plots the subgraph 3
xlim([-1,1]); %% sets x-axis to [-1,1]
ylim([-0.5,1.2]); %% sets y-axis of g1(t) to [-0.5,1.2]
title('Subplot 3: g3(t)') %% title of the subplot
xlabel('time'); %X-label
ylabel('g3(t)'); %Y-label

%%fourth subplot
subplot(2,2,4)
plot(a,g4); %% plots the subgraph 4
xlim([-1,1]); %% sets x-axis to [-1,1]
ylim([-2.2,2.2]); %% sets y-axis of g4(t) to [-2.2,2.2]
title('Subplot 4: g4(t)'); %% title of the subplot
xlabel('time'); %X-label
ylabel('g4(t)'); %Y-label

end

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