Solution:
The SIGSHIFT and SIGADD are the minor programs which can be downloaded from the web easily.
Following is the program that evaluates the (a) and (b) part:
clc; clear variables;
% Given Data
n1 = -3:4; % Domain for Seq_1
n2 = -1:5; % Domain for Seq_2
n3 = 2:8; % Domain for Seq_3
x = [-4 5 1 -2 -3 0 2 4.5];
y = [6 -3 -1 0 8 7 -2];
w = [3 2 2 -1 0 -2 5];
%% Solution
% 1) To find u(n) = x(n) + y(n-2)
% First we will shift y by 2 and then add x
[Y_new , n2_new] = sigshift(y,n2,2);
[u , n_u] = sigadd(x,n1,Y_new,n2_new);
figure(1)
plot(n_u,u)
grid on
xlabel('n');
ylabel('u')
% 2) To find s(n) = -y(n) + w(n+4)
Y_negative = -y;
[W_new , n3_new] = sigshift(w,n3,-4);
[s , n_s] = sigadd(Y_negative,n2,W_new,n3_new);
figure(2)
plot(n_s,s)
grid on
xlabel('n');
ylabel('s')
The above program uses SIGSHIFT and SIGADD which are as follows:
SIGSHIFT
function [y,n] = sigshift(x,m,n0)
% implements y(n) = x(n-n0)
% -------------------------
% [y,n] = sigshift(x,m,n0)
%
n = m+n0; y = x;
SIGADD
function [y,n] = sigadd(x1,n1,x2,n2)
% implements y(n) = x1(n)+x2(n)
% -----------------------------
% [y,n] = sigadd(x1,n1,x2,n2)
% y = sum sequence over n, which includes n1 and n2
% x1 = first sequence over n1
% x2 = second sequence over n2 (n2 can be different from n1)
%
n = min(min(n1),min(n2)):max(max(n1),max(n2)); % duration of y(n)
y1 = zeros(1,length(n)); y2 = y1; % initialization
y1(find((n>=min(n1))&(n<=max(n1))==1))=x1; % x1 with duration of y
y2(find((n>=min(n2))&(n<=max(n2))==1))=x2; % x2 with duration of y
y = y1+y2; % sequence addition
Following are the plots obtained :
a)
b)
What’s the answer for (a) and (b) using Matlab? Problem 1: Consider the following sequences x(n)...
3. Let xn] -1, 0,1,2, 3,4,4,4,4,4) (a) Determine the sequences x[--n], x{n 3], and xn 21 by hand (b) Determine the sequences in (a) using the fold and shift functions. (c) Plot the sequences x[n],x[-n], x{n 3], and x[n +2] using the function stem.
Using the basic developed MATLAB signal functions, generate the following sequences and then plot the signal samples using the stem function. x_1[n] = 3 delta[n + 2] + 2 delta[n] - delta[n - 3] + 5 delta[n - 7], for -5 lessthanorequalto n lessthanorequalto 15. X_2[n] = 10u[n] - 5u[n - 5] - 10u[n - 10] + 5u[n - 15]. Generate the periodic sequence and plot the samples (using the stem function) of cap x[n] = {..., -2, -1, 0,...
please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...
Q4. Consider the two sequences x [n] = [0 otherwise h[n] = {00 otherwise α>1 calculate the convolution of two signals. Q5. Consider an L'TI system with input x (o] and impulse response h (o] specified as follows. x [n] = 2"u [-n] h [n] -u [n] Find the output y [n] using convolution sum. Q4. Consider the two sequences x [n] = [0 otherwise h[n] = {00 otherwise α>1 calculate the convolution of two signals. Q5. Consider an L'TI...
************PLEASE INCLUDE MATLAB CODES*********** Find y(n) by Performing graphical convolution of the following sequences and confirm your results via Matlab (Include Matlab code and graphics). Bold sample represent the sample value at n = 0 a. x(n) = {1, 2, 1, 1}, h(n) = {1, -1, 0, 0, 1, 1} b. x(n) = {1, 1, 0, 1, 1}, h(n) = {1, 2, 3, 2, 1}
2. A system is described by the following difference equation n]1.5y[n0.56y[n -2]+x{n-0.2x{n-] a) Find the transfer function of the system b) Let xn]un]. Compute an analytical expression for the response y[n]. Use Matlab to calculate the coefficients c) Simulate and plot the response using Matlab.(stem plot) Generate 50 points. (Matlab: x ones(1,50)); 2. A system is described by the following difference equation n]1.5y[n0.56y[n -2]+x{n-0.2x{n-] a) Find the transfer function of the system b) Let xn]un]. Compute an analytical expression for...
consider the signal using matlab Problem 2: Consider a signal: x[n] 3cos(n7/3) + 2sin(nt/4)+ cos(n7/5) Using Matlab, (1) Plot this signal in time domain. Can you identify the various frequencies in this signal? Use n 0:1:1000 (2) Plot this signal in frequency domain using the "fft" command. Identify the individual frequencies in the plot. (3) Calculate the frequencies of these signals. In the frequency plot, 1000 2
solve using MatLab please. HW - 1 Use a cover page Word file attached for the homework solution. Solve all questions using Word and the Matlab output should be copied into the Word file. All questions and answers should be numbered HW1.1 Generate the following sequences using the basic MATLAB signal functions and the basic MATLAB signal operations discussed in this chapter. Plot signal samples using the stem function. 1- x(n) = n°[u(n+5] – u(n-6) + 105(n) + 20(0.5)* [u(n-4)...
%code_5_1_Sayama.m % % This script makes a phase portrait for % x(n) = 0.5*x(n-1) + y(n-1); % y(n) = -0.5*x(n-1) + y(n-1); % % Initial conditions: % x0 ranges from -2 to 2 in increments of 0.5 % y0 ranges from -2 to 2 in increments of 0.5 % % t=30 timesteps % % Modified from Sayama, by C. Bliss % ====================================================================== t=30; %timesteps x=zeros(1,t); y=zeros(1,t); for a=-2:0.5:2 for b=-2:0.5:2 %initialize x and y x(1)=a; y(1)=b; %run the simulation...
Consider the system:y[n]-0.5y[n-1]-0.25y[n-2]=x[n]+2x[n-1]+x[n-2] • Plot, using MATLAB, the impulse and step responses of the system. Highlight the response characteristics in your plots • Assume initial conditions y(-1) = 1, y(-2) = 0 and that the input signal to the system is a discrete-time unit step. Determine the formula for the Z-transform of the solution, Y(z). Subsequently, determine the formula for the solution, y[n], itself.