Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

N=256; %% sampling number n=linspace(0,1,N); fs=1/(n(2)-n(1)); x=5*(sin((2*pi*10*n)+deg2rad(30))); %% creat signal figure; N=length(x); f=[-fs/2:fs/N:fs/2-fs/N]; subplot(211) plot(f,fftshift(abs(fft(x))),'b'); title('|G(f)|');grid; xlabel('frequency'); ylabel('|G(f)|'); %Zero padding xx=[zeros(1,128) x zeros(1,128)]; N=length(xx); f=[-fs/2:fs/N:fs/2-fs/N];

N=256; %% sampling number

n=linspace(0,1,N);

fs=1/(n(2)-n(1));

x=5*(sin((2*pi*10*n)+deg2rad(30))); %% creat signal

figure;

N=length(x);

f=[-fs/2:fs/N:fs/2-fs/N];

subplot(211)

plot(f,fftshift(abs(fft(x))),'b');

title('|G(f)|');grid;

xlabel('frequency');

ylabel('|G(f)|');

%Zero padding

xx=[zeros(1,128) x zeros(1,128)];

N=length(xx);

f=[-fs/2:fs/N:fs/2-fs/N];

subplot(212)

plot(f,fftshift(abs(fft(xx))),'r');

title('|Gz(f)|');grid;

xlabel('frequency');

ylabel('|Gz(f)|');

.

.

Question : Use upper code. Let's say IFFT the above fz(f) function is gz(nTs). Plot the function spectrum (N = 512)

1. Plot the spectrum of the function g1[m] (m = 1,2,3 ... 128) generated by changing the sampling interval Ts of gz(t) to 4Ts. (Observe aliasing)

2. Plot the spectrum of the function g2[m] (m = 1,2,3 ... 256) generated by changing the sampling interval Ts of gz(t) to 2Ts.

3. Plot the spectrum zero-padding g2[m] by 128 left and right.

.

You can use reference code below.

.

.

%% Create discrete signal % create x[n]=0.4cos(0.7n) n=1:0.01:100; %time vector figure(1); plot(n,0.4*cos(0.7*pi*n)); %signal generation xlabel('time'); ylabel('amplitude'); title('0.4cos(0.7n) graph');

.

.

%% convolution % Find the convolution of the input signal x[n] and the LTI system h[n] a=[0 0 1 1 1 1 1 0 0]; b=[0 0 2 2 2 2 2 0 0]; %signal generation convolution=conv(a,b); %convolution m=length(convolution)-1; n=0:1:m; figure(2) plot(n,convolution); xlabel('time'); ylabel('amplitude'); title('convolution graph');

.

.

%% FFT %Fourier transform after signal generation

Fs= 100; % sampling frequency Ts=1/Fs; %sampling time T=100; %length of time t=linspace(0,T,T/Ts); %time vector

x=0.4*cos(2*pi*30*t); %signal generation f=linspace(-Fs/2,Fs/2,length(t)); %frequency vector fft_x=fftshift(fft(x)); %FFT abs_fft_x=abs(fft_x); figure(3) plot(f,abs_fft_x); title('FFT') xlabel('frequency'); ylabel('magnitude');

Thanks in advance :)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Accounting questions

Question

Identify the types of informal reports.

Answered: 1 week ago

Question

Write messages that are used for the various stages of collection.

Answered: 1 week ago