This is for Matlab: can you help with both problems 2 and 3 please? I know it\'s
ID: 2079375 • Letter: T
Question
This is for Matlab:
can you help with both problems 2 and 3 please? I know it's simple but just can't figure it out
Explanation / Answer
2)
%Program 2:Autocorrelation of a rectangular sequence.
clc;
close all;
N=10;
M=20;
k=-N:M;
%Generate the square squence
x=[zeros(1,N),ones(1,M+1)];
subplot(2,1,1);
stem(k,x);
xlabel('n');
ylabel('u(n)');
k=-(N-5):M+5;
subplot(2,1,2);
stem(k,x);
xlabel('n');
ylabel('u(n-5)');
3)
clc;
close all;
N=40;
M=80;
n=-N:M;
%Generate cosine sequence
x=7*cos(0.1*n) + cos(0.95*n);
subplot(2,1,1);
stem(n,x);
xlabel('n');
ylabel('cos(n)');
n=-(N):M;
x=7*cos(0.1*[n-5]) + cos(0.95*[n-5]);
subplot(2,1,2);
stem(n,x);
xlabel('n');
ylabel('cos(n-5)');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.