Question

4. Using Matlab: 4.1. Plot | H(n the following cases: (the frequency range: 0-20 KHz) a. a 0.2 0.5 ms. b. α-0.8 C.α-0.2 c-0.1
0 0
Add a comment Improve this question Transcribed image text
Answer #1

clear all;
close all;

alpha = input("Enter alpha value :\n");

c_ms = input("Enter c value in ms :\n");

c = c_ms*0.001; %convert c to seconds

fmin = 0;

fmax = 20000;

w = 2*pi*fmin:0.01:2*pi*fmax;

%%%%%%%%%%%%%%% solution to 4.1 %%%%%%%%%%%%%%%%%%

Hw = sqrt((1+alpha^2) + 2*alpha*cos(w*c));

figure;plot(w, Hw)
titletext1=['|H(w)| vs w for alpha = ', num2str(alpha),' and c = ', num2str(c_ms),' ms'];
title(titletext1);
xlabel('w=2*pi*f (rad/s) ----> ');
ylabel('|H(w)|');
xlim([min(w) max(w)]);

%%%%%%%%%%%%%%%    Solution to part 4.2   %%%%%%%%%%%%%%%%%%%%

Xw = (50000*w)./(2*pi*2000+w).^2;

figure;plot(w,Xw);
title('X(w) vs w ');
xlabel('w=2*pi*f (rad/s) ----> ');
ylabel('X(w)');
xlim([min(w) max(w)]);

Yw = Hw.*Xw;

figure;plot(w,Yw);
titletext2=['Y(w) vs w for alpha = ', num2str(alpha),' and c = ', num2str(c_ms),' ms'];
title(titletext2);
xlabel('w=2*pi*f (rad/s) ----> ');
ylabel('Y(w)');
xlim([min(w) max(w)]);

%%%%%%%%%%%%%%%%     Solution to part 4.3    %%%%%%%%%%%%%

xt = abs(ifftshift(ifft(Xw))); % time domain signal from frequency domain signal
audiowrite('x.wav',xt,2*fmax); % save x(t) in .wav format

yt = abs(ifftshift(ifft(Yw)));

% different filename for different alpha and c
audio_title = ['y_alpha_',num2str(alpha),'_c_', num2str(c_ms),'.wav'];
audiowrite(audio_title,yt,2*fmax); % save y(t) in .wav format

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Command Window > magni tude_spectrum Enter alpha value 0.2 Enter c value in ms 0.5 >magni tude_spectrum Enter alpha value: 0.

Plots of |H(w)| for difference values of alpha and c:

Figure 1 (on gpuwks) File Edit View Insert Iools Desktop Window Help [H(w)l vs w for alpha-0.2 and c = 0.5 ms 1.2 1.15 1.1 1.

Figure 1 (on gpuwks) File Edit View Insert Iools Desktop Window Help [H(w)l vs w for alpha-0.8 and c = 0.5 ms 1.8 1.6 1.4 1.2

Figure 1 (on gpuwks) File Edit View Insert Iools Desktop Window Help [H(w)l vs w for alpha = 0.2 and c = 0.1 ms 1.2 1.15 1.1

Plot of X(w) [independent of alpha and c] :

Figure 2 (on gpuwks) File Edit View Insert Iools Desktop Window Help X(w) vs w 0.9 0.8 0.7 0.6 30.5 0.4 0.3 0.2 0.1 10 0 4 W-

Plots of Y(w) for difference values of alpha and c:

Figure 3 (on gpuwks) File Edit View Insert Iools Desktop Window Help Y(w) vs w for alpha = 0.2 and c 0.5 ms 1.2 0.8 0.6 0.4 0

Figure 3 (on gpuwks) File Edit View Insert Iools Desktop Window Help Y(w) vs w for alpha = 0.8 and c 0.5 ms 1.8 1.6 1.4 1.2 0

Figure 3 (on gpuwks) File Edit View Insert Iools Desktop Window Help Y(w) vs w for alpha = 0.2 and c 0.1 ms 1.2 r 0.8 0.6 0.4

Add a comment
Know the answer?
Add Answer to:
4. Using Matlab: 4.1. Plot | H(n the following cases: (the frequency range: 0-20 KHz) a. a 0.2 0.5 ms. b. α-0.8 C.α-0.2 c-0.1 ms. c 0.5 ms. 4.2. Consider a signal whose Fourier Transform is given...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT