Answer To: EGR324L: Linear Systems and Signals Lab Lab 4: Convolution Sum Objective To learn how to compute...
Kshitij answered on Oct 10 2021
nw gray/ans2.m
ox=-2
vx=[1 -2];
oh=3;
vh=[-1 0 3 2];
[oy,vy]=gconv(ox,vx,oh,vh)
nw gray/ans5.m
x=rand(10,1)
a=0.5;
N0=100;
d=0.01
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/ans6.m
x=rand(100,1)
sound(x)
a=0.7;
N0=100;
d=0.05
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/ans7.m
x=rand(100,1)
a=0.7;
N0=10;
d=0.05
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/answer3.m
%a) if N=4
clc;
clear all;
close all;
n=0:5;%%creating time vector
N=4;%%taking N=4
x=(n>=0)-(n>=(N+1));%%generating x[n] sequence
h=(n>=0)-(n>=4);%%generating h[n] sequence
y=conv(x,h);%%convolution of x[n] and h[n]
disp(y);%%displaying y[n]
stem(y);%%plootting y[n]
xlabel('n--->');
ylabel('y[n]--->');
title('convoltion of x[n) and h[n]')
%%b)calculting the value of N<=5 for which y[3]=3 and y[6]=0
for N=0:5%%taking for loop for N from 0 to 5
x=(n>=0)-(n>=(N+1));%%calculting x[n] for each value of N
y1=conv(x,h);%% calculating new convolution sequence
if (y1(3+1)==3 & y1(6+1)==0)%%comparing x[3]=3 and y[6]=0
fprintf('the N values for y[3]=3 and y[6]=0 is %d \n ',N)
end
end
nw gray/gconv.m
function [oy,vy]=gconv(ox,vx,oh,vh)
nx=ox:1:length(vx)+ox; % Defining Axis for Vx vector
nh=oh:1:length(vh)+oh; % Defining Axis for Vh vector
vy=conv(vx,vh); %...