CJamie

exp

Oct 11th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.94 KB | None | 0 0
  1. 1a
  2. % %PLOT UNIT STEP FUNCTION
  3. % t=[-10:1:10];
  4. % us=(t>=0);
  5. % subplot(2,2,1);
  6. % plot(t,us);
  7. % % plot(t,us);
  8. % xlabel('Values of t'); %FOR LABELING X AND Y
  9. % ylabel('Amplitude x(t)');
  10. % title('UNIT STEP FUNCTION(CONT.)-102095004');
  11. %
  12. % %PLOT UNIT IMPULSE FUNCTION
  13. % t=[-10:1:10];
  14. % usi=(t==0);
  15. % subplot(2,2,3);
  16. % plot(t,usi);
  17. % xlabel('Values of t'); %FOR LABELING X AND Y
  18. % ylabel('Amplitude x(t)');
  19. % title('UNIT IMPULSE FUNCTION(CONT.)-102095004');
  20. %
  21. % %PLOT UNIT STEP FUNCTION
  22. % t=[-10:1:10];
  23. % us=(t>=0); %BY DEFAULT VALUE IS 1
  24. % subplot(2,2,2);
  25. % stem(t,us);
  26. % stem(t,us);
  27. % xlabel('Values of n'); %FOR LABELING X AND Y
  28. % ylabel('Amplitude x(n)');
  29. % title('UNIT STEP FUNCTION(DISCRETE)-102095004');
  30. %
  31. % %PLOT UNIT IMPULSE FUNCTION
  32. % t=[-10:1:10];
  33. % usi=(t==0);
  34. % subplot(2,2,4);
  35. % stem(t,usi);
  36. % xlabel('Values of n'); %FOR LABELING X AND Y
  37. % ylabel('Amplitude x(n)');
  38. % title('UNIT IMPULSE FUNCTION(DISCRETE)-102095004');
  39.  
  40. for x=-10:1:10
  41. if x>=0;
  42. a=1;
  43. hold on;
  44. else
  45. a=-1;
  46. hold on;
  47. end
  48. stem(x,a);
  49. xlabel('Values of n'); %FOR LABELING X AND Y
  50. ylabel('Amplitude x(n)');
  51. title('SIGNUM FUNCTION(DISCRETE)-102095004');
  52. end
  53.  
  54. _______________________________________________________________
  55.  
  56. 1b
  57.  
  58. t=0:0.005:0.5;
  59. f=input('frequency=');
  60. duty1=input('duty1=');
  61. duty2=input('duty2=');
  62. duty3=input('duty3=');
  63. x=square(2*pi*f*t, duty1);
  64. y=square(2*pi*f*t, duty2);
  65. z=square(2*pi*f*t, duty3);
  66.  
  67. % subplot(3,1,1)
  68. % stem(t,x);
  69. % title('Discrete Square Wave[duty cycle=25](102095004)');
  70. % xlabel('n');
  71. % ylabel('x(n)');
  72. % grid on;
  73. subplot(3,1,1)
  74. plot(t,x);
  75. title('Continuous Square Wave[duty cycle=25](102095004)');
  76. xlabel('t');
  77. ylabel('x(t)');
  78. grid on;
  79.  
  80.  
  81. % subplot(3,1,2)
  82. % stem(t,y);
  83. % title('Discrete Square Wave[duty cycle=50](102095004)');
  84. % xlabel('n');
  85. % ylabel('y(n)');
  86. % grid on;
  87. subplot(3,1,2)
  88. plot(t,y);
  89. title('Continuous Square Wave[duty cycle=50](102095004)');
  90. xlabel('t');
  91. ylabel('y(t)');
  92. grid on;
  93.  
  94.  
  95. % subplot(3,1,3)
  96. % stem(t,z);
  97. % title('Discrete Square Wave[duty cycle=75](102095004)');
  98. % xlabel('n');
  99. % ylabel('z(n)');
  100. % grid on;
  101. subplot(3,1,3)
  102. plot(t,z);
  103. title('Continuous Square Wave[duty cycle=75](102095004)');
  104. xlabel('t');
  105. ylabel('z(t)');
  106. grid on;
  107. _______________________________________________________________
  108.  
  109. 1c
  110.  
  111. a1=input('Amplitude1=');
  112. f1=input('Frequency1=');
  113. p1=input('phase1=');
  114. a2=input('Amplitude2=');
  115. f2=input('Frequency2=');
  116. p2=input('phase2=');
  117. t=(0:0.001:0.25);
  118.  
  119. x1=a1*(sin((2*pi*f1*t)+ p1));
  120. subplot(2,1,1);
  121. plot(t,x1);
  122. grid on;
  123. title('Sine Wave[a=10,f=60,p=0] (102095004)');
  124. xlabel('t');
  125. ylabel('t(x)');
  126. x2=a2*(sin((2*pi*f2*t)+ p2));
  127. subplot(2,1,2);
  128. plot(t,x2);
  129. grid on;
  130. title('Sine Wave[a=20,f=60,p=pi] (102095004)');
  131. xlabel('t');
  132. ylabel('t(x)');
  133.  
  134. ________________________________________________________________
  135.  
  136. 2
  137.  
  138. % %PLOT UNIT STEP FUNCTION
  139. % t=[-10:1:10];
  140. % us=(t>=0);
  141. % subplot(2,2,1);
  142. % plot(t,us);
  143. % % plot(t,us);
  144. % xlabel('Values of t'); %FOR LABELING X AND Y
  145. % ylabel('Amplitude x(t)');
  146. % title('UNIT STEP FUNCTION(CONT.)-102095004');
  147. %
  148. % %PLOT UNIT IMPULSE FUNCTION
  149. % t=[-10:1:10];
  150. % usi=(t==0);
  151. % subplot(2,2,3);
  152. % plot(t,usi);
  153. % xlabel('Values of t'); %FOR LABELING X AND Y
  154. % ylabel('Amplitude x(t)');
  155. % title('UNIT IMPULSE FUNCTION(CONT.)-102095004');
  156. %
  157. % %PLOT UNIT STEP FUNCTION
  158. % t=[-10:1:10];
  159. % us=(t>=0); %BY DEFAULT VALUE IS 1
  160. % subplot(2,2,2);
  161. % stem(t,us);
  162. % stem(t,us);
  163. % xlabel('Values of n'); %FOR LABELING X AND Y
  164. % ylabel('Amplitude x(n)');
  165. % title('UNIT STEP FUNCTION(DISCRETE)-102095004');
  166. %
  167. % %PLOT UNIT IMPULSE FUNCTION
  168. % t=[-10:1:10];
  169. % usi=(t==0);
  170. % subplot(2,2,4);
  171. % stem(t,usi);
  172. % xlabel('Values of n'); %FOR LABELING X AND Y
  173. % ylabel('Amplitude x(n)');
  174. % title('UNIT IMPULSE FUNCTION(DISCRETE)-102095004');
  175.  
  176. for x=-10:1:10
  177. if x>=0;
  178. a=1;
  179. hold on;
  180. else
  181. a=-1;
  182. hold on;
  183. end
  184. stem(x,a);
  185. xlabel('Values of n'); %FOR LABELING X AND Y
  186. ylabel('Amplitude x(n)');
  187. title('SIGNUM FUNCTION(DISCRETE)-102095004');
  188. end
  189.  
  190. _______________________________________________________________
  191.  
  192. 3
  193.  
  194. %dft of seq
  195. clear all;
  196. clc;
  197. j=sqrt(-1);
  198. xn=input('Enter a sequence: ');
  199. N=length(xn);
  200. disp(N);
  201. xk=zeros(1,N);
  202. for k=0:1:N-1
  203. for n=0:1:N-1
  204.  
  205. xk(k+1) = xk(k+1) + xn(n+1)*exp(-j*2*pi*k*n/N);
  206.  
  207. end
  208. end
  209.  
  210. disp('THE DFT SEQUENCE IS:');
  211. xk
  212. disp('THE MAGNITUDE SEQUENCE IS:');
  213. magxk=abs(xk)
  214. disp('THE PHASE SEQUENCE IS:');
  215. phaxk=angle(xk)
  216.  
  217. wk=0:1:N-1
  218. subplot(5,1,1);
  219. stem(wk,xn);
  220. xlabel('k'); %FOR LABELING X AND Y
  221. ylabel('xn (db)');
  222. title('Input Sequence-102095004');
  223.  
  224. subplot(5,1,2);
  225. stem(wk,xk);
  226. xlabel('k'); %FOR LABELING X AND Y
  227. ylabel('xk (db)');
  228. title('DFT-102095004');
  229.  
  230. subplot(5,1,3);
  231. stem(wk,magxk);
  232. xlabel('k'); %FOR LABELING X AND Y
  233. ylabel('Magnitude(db)');
  234. title('Magnitude Spectrum-102095004');
  235.  
  236. subplot(5,1,4);
  237. stem(wk,phaxk);
  238. xlabel('k'); %FOR LABELING X AND Y
  239. ylabel('Phase(degree)');
  240. title('Phase Spectrum-102095004');
  241.  
  242. %IDFT
  243. N=length(xk);
  244. ixk=zeros(1,N);
  245. for k=0:1:N-1
  246. for n=0:1:N-1
  247.  
  248. ixk(k+1) = ixk(k+1) + ((1/N)*(xk(n+1)*exp(j*2*pi*k*n/N)));
  249.  
  250. end
  251. end
  252. disp('THE IDFT SEQUENCE IS:');
  253. ixk
  254. subplot(5,1,5);
  255. stem(wk,ixk);
  256. xlabel('k'); %FOR LABELING X AND Y
  257. ylabel('ixk (db)');
  258. title('IDFT-102095004');
  259.  
  260. ______________________________________________________________
  261.  
  262. 4a
  263.  
  264. clc
  265. clear all
  266. % n= (-10:10);%generating independent variables
  267. x = input('input the first sequence: ')
  268. h = input('input the second sequence:')
  269.  
  270. subplot(3,1,1);
  271. stem(x);
  272. xlabel('n'); %FOR LABELING X AND Y
  273. ylabel('x');
  274. title('x(n)-1020950040...................................................................................................................................................................................................................................................................................................................................................................................................................................................');
  275.  
  276. subplot(3,1,2);
  277. stem(h);
  278. xlabel('n'); %FOR LABELING X AND Y
  279. ylabel('h');
  280. title('h(n)-102095004');
  281.  
  282. %for linear convuution length
  283. N1=length(x);
  284. N2=length(h);
  285. N=N1+N2-1;
  286.  
  287. xn=[x,zeros(1,N-N1)];
  288. hn=[h,zeros(1,N-N2)];
  289. y=zeros(1,N);
  290.  
  291. %circular convulution length
  292. for i=0:N-1
  293. for j=0:N-1
  294. z=mod(i-j,N);
  295. y(i+1) = y(i+1) + xn(j+1).*hn(z+1);
  296. end
  297. z;
  298. end
  299. disp('Linear convulution using circular covulution sequence is given as (102095004): ');y
  300. subplot(3,1,3);
  301. stem(y);
  302. xlabel('k'); %FOR LABELING X AND Y
  303. ylabel('y(n)');
  304. title('Linear convulution using circutlar convulution-102095004');
  305. _______________________________________________________________
  306.  
  307. 4b
  308.  
  309. clc
  310. clear all
  311. % n= (-10:10);%generating independent variables
  312. x = input('input the first sequence: ')
  313. h = input('input the second sequence:')
  314.  
  315. subplot(3,1,1);
  316. stem(x);
  317. xlabel('n'); %FOR LABELING X AND Y
  318. ylabel('x');
  319. title('x(n)-1020950040...................................................................................................................................................................................................................................................................................................................................................................................................................................................');
  320.  
  321. subplot(3,1,2);
  322. stem(h);
  323. xlabel('n'); %FOR LABELING X AND Y
  324. ylabel('h');
  325. title('h(n)-102095004');
  326.  
  327. %for linear convuution length
  328. N1=length(x);
  329. N2=length(h);
  330. N=N1+N2-1;
  331.  
  332. xn=[x,zeros(1,N-N1)];
  333. hn=[h,zeros(1,N-N2)];
  334. y=zeros(1,N);
  335.  
  336. %circular convulution length
  337. for i=0:N-1
  338. for j=0:N-1
  339. z=mod(i-j,N);
  340. y(i+1) = y(i+1) + xn(j+1).*hn(z+1);
  341. end
  342. z;
  343. end
  344. disp('Linear convulution using circular covulution sequence is given as (102095004): ');y
  345. subplot(3,1,3);
  346. stem(y);
  347. xlabel('k'); %FOR LABELING X AND Y
  348. ylabel('y(n)');
  349. title('Linear convulution using circutlar convulution-102095004');
  350.  
  351. ______________________________________________________________
  352.  
  353. 4c
  354.  
  355. clc;
  356. clear all;
  357. % n= (-10:10);%generating independent variables
  358. %humesha start from 1:n array me store krane k liye
  359. x = input('input the first sequence: ')
  360. h = input('input the second sequence:')
  361.  
  362. subplot(4,1,1);
  363. stem(x);
  364. xlabel('n'); %FOR LABELING X AND Y
  365. ylabel('x');
  366. title('x(n)-102095004');
  367.  
  368. subplot(4,1,2);
  369. stem(h);
  370. xlabel('n'); %FOR LABELING X AND Y
  371. ylabel('h');
  372. title('h(n)-102095004');
  373.  
  374. m=length(x);
  375. n=length(h);
  376.  
  377. hn=[h,zeros(1,m-1)];
  378. xn=[x,zeros(1,n-1)];
  379.  
  380. y=zeros(1,m+n-1);
  381.  
  382. for i=1:m+n-1
  383. sum=0;
  384. for j=1:i
  385. sum=sum+(xn(j)*hn(i-j+1));
  386. end
  387. y(i)=sum;
  388. end
  389. % disp('Linear convolution is given as (102095004): ');
  390. y;
  391. subplot(4,1,3);
  392. stem(y);
  393. xlabel('n'); %FOR LABELING X AND Y
  394. ylabel('y(n)');
  395. title('Linear convulution-102095004');
  396.  
  397. %code or circular ---->
  398. %find the linear convulution ----> jitna extra aa rha uuse add krr do pehle dosre (see graph nb) ---->
  399.  
  400. %length of linear convulution peeche se iteration start krrna
  401. N=max(n,m); %defines the output buffer
  402. p=zeros(1,N);
  403. q=zeros(1,N);
  404. z=zeros(1,N);
  405. for i=1:N
  406. %z(i) me store krana
  407. p(i)=y(i);
  408. end
  409. p;
  410. for i=1:m+n-1-N
  411. q(i)=y(N+i);
  412. %add last wala to first circularly
  413. end
  414. q;
  415. for i=1:N
  416. z(i)=p(i)+q(i);
  417. %add last wala to first circularly
  418. end
  419. disp('Circular convolution using linear convolution is given as (102095004): ')
  420. z
  421. subplot(4,1,4);
  422. stem(z);
  423. xlabel('n'); %FOR LABELING X AND Y
  424. ylabel('z(n)');
  425. title('Circular convulution using Linear convulution-102095004');
  426.  
  427. _______________________________________________________________
  428.  
  429. 4d
  430.  
  431. clc;
  432. clear all;
  433. % n= (-10:10);%generating independent variables
  434. x = input('input the first sequence: ')
  435. h = input('input the second sequence:')
  436.  
  437. N1=length(x);
  438. N2=length(h);
  439. N=max(N1,N2);
  440.  
  441. disp('dft of x(n)= X(k)')
  442. xf=fft(x,N)
  443. disp('dft of h(n)= H(k)')
  444. hf=fft(h,N)
  445.  
  446. disp('multiplication of X(k) and H(k)= Y(k)')
  447. yk=xf.*hf
  448.  
  449. disp('idft of Y(k) = y(n)')
  450. yn=ifft(yk)
  451.  
  452. disp('circular convulution of x(n) and h(n) (102095004)')
  453. y=cconv(x,h,N)
  454.  
  455. subplot(4,1,1);
  456. stem(x);
  457. xlabel('n'); %FOR LABELING X AND Y
  458. ylabel('x(n)');
  459. title('x(n) - 102095004');
  460.  
  461. subplot(4,1,2);
  462. stem(h);
  463. xlabel('n'); %FOR LABELING X AND Y
  464. ylabel('h(n)');
  465. title('h(n) - 102095004');
  466.  
  467. subplot(4,1,3);
  468. stem(yn);
  469. xlabel('n'); %FOR LABELING X AND Y
  470. ylabel('y(n)');
  471. title('Circular convultion by IDFT-102095004');
  472.  
  473. subplot(4,1,4);
  474. stem(y);
  475. xlabel('n'); %FOR LABELING X AND Y
  476. ylabel('y(n)');
  477. title('Circular convultion by inbuit function-102095004');
  478.  
  479. _________________________________________________________________
  480.  
  481. 5a
  482.  
  483. clc;
  484. clear all;
  485.  
  486. M=25;
  487. v = 0:1:M-1;
  488. rec=zeros(length(M-1));
  489. tr = zeros(length(M-1));
  490. ham = zeros(length(M-1));
  491. han = zeros(length(M-1));
  492. blk = zeros(length(M-1));
  493. for n=0:1:M-1
  494. rec(n+1)=1;
  495. ham(n+1) = 0.54-(0.46*cos((2*pi*n)/(M-1)));
  496. han(n+1) = 0.5*(1-cos((2*pi*n)/(M-1)));
  497. blk(n+1) = 0.42-(0.5*cos((2*pi*n)/(M-1)))+(0.08*cos((4*pi*n)/(M-1)));
  498. if n<=(M-1)/2
  499. tr(n+1)=(2*n)/(M-1);
  500. elseif n>(M-1)/2 && n<=M-1
  501. tr(n+1)=2-((2*n)/(M-1));
  502. end
  503. end
  504. figure
  505. title('Time domain response for fixed windows(102095004)');
  506. subplot(2,3,1)
  507. plot(v,rec,'b')
  508. title('rectangular')
  509. xlabel('t')
  510. ylabel('Amplitude')
  511.  
  512. subplot(2,3,2)
  513. plot(v,tr,'m')
  514. title('triangular')
  515. xlabel('t')
  516. ylabel('Amplitude')
  517.  
  518.  
  519. subplot(2,3,3)
  520. plot(v,ham,'c')
  521. title('hamming')
  522. xlabel('t')
  523. ylabel('Amplitude')
  524.  
  525.  
  526.  
  527. subplot(2,3,4)
  528. plot(v,han,'r')
  529. title('hanning')
  530. xlabel('t')
  531. ylabel('Amplitude')
  532.  
  533. subplot(2,3,5)
  534. plot(v,blk,'g')
  535. title('blackman')
  536. xlabel('t')
  537. ylabel('Amplitude')
  538.  
  539. xlim([0,M+2]);
  540. ylim([0,1.1]);
  541.  
  542. N=1024
  543. xaxis= 0:1/N:(N-1)/N
  544. figure
  545. title('Frequency domain response for fixed windows(102095004)');
  546. subplot(2,3,1)
  547. fftrec= fft(rec,N)
  548. fyaxis= abs(fftrec/max(fftrec))
  549. yaxis= 20*log(fyaxis)
  550. plot(xaxis,fftshift(yaxis),'b')
  551. title('rectangular')
  552. xlabel('freq')
  553. ylabel('magnitude(db)')
  554.  
  555.  
  556. subplot(2,3,2)
  557. ffttr= fft(tr,N)
  558. fyaxis= abs(ffttr/max(ffttr))
  559. yaxis= 20*log(fyaxis)
  560. plot(xaxis,fftshift(yaxis),'m')
  561. title('triangular')
  562. xlabel('freq')
  563. ylabel('magnitude(db)')
  564.  
  565.  
  566. subplot(2,3,3)
  567. fftham= fft(ham,N)
  568. fyaxis= abs(fftham/max(fftham))
  569. yaxis= 20*log(fyaxis)
  570. plot(xaxis,fftshift(yaxis),'c')
  571. title('hamming')
  572. xlabel('freq')
  573. ylabel('magnitude(db)')
  574.  
  575.  
  576. subplot(2,3,4)
  577. ffthan= fft(han,N)
  578. fyaxis= abs(ffthan/max(ffthan))
  579. yaxis= 20*log(fyaxis)
  580. plot(xaxis,fftshift(yaxis),'r')
  581. title('hanning')
  582. xlabel('freq')
  583. ylabel('magnitude(db)')
  584.  
  585.  
  586. subplot(2,3,5)
  587. fftblk= fft(blk,N)
  588. fyaxis= abs(fftblk/max(fftblk))
  589. yaxis= 20*log(fyaxis)
  590. plot(xaxis,fftshift(yaxis),'g')
  591. title('blackman')
  592. xlabel('freq')
  593. ylabel('magnitude(db)')
  594.  
  595. _____________________________________________________________
  596.  
  597. 6a
  598.  
  599. clc;
  600. clear all;
  601. %DEFINING PARAMETERES
  602. wp =input('Enter pass band frequency: ') * pi;
  603. ws =input('Enter stop band frequency: ') * pi;
  604.  
  605. tr_width =abs(ws-wp);
  606. wc = (wp+ws)/2;
  607.  
  608. %DEFINING WINDOW
  609. M = ceil(1.8*pi/tr_width);
  610. wn=(rectwin(M));
  611. n = -(M-1)/2:(M-1)/2;
  612.  
  613. fc = wc/(2*pi);
  614. hd = 2*fc*(sinc(2*fc*n));
  615.  
  616. h=hd.*wn';
  617. [HW,WW] = freqz(h,1);
  618.  
  619. subplot(2,1,1);
  620. stem(n,wn);
  621. title('Rectangular Window 102095004');
  622. xlabel('n-->');
  623. ylabel('W[n]-->');
  624.  
  625. subplot(2,1,2);
  626. plot(WW./pi,abs(HW));
  627. title('Low Pass Filter 12095004');
  628. xlabel('Normalised Freq-->');
  629. ylabel('Magnitude-->')
  630.  
  631. ______________________________________________________________
  632.  
  633. 6b
  634.  
  635. clc;
  636. clear all;
  637. wp =input('Enter pass band frequency: ') * pi;
  638. ws =input('Enter stop band frequency: ') * pi;
  639. tr_width =abs(ws-wp);
  640. wc = (wp+ws)/2;
  641. M = ceil(6.1*pi/tr_width);
  642. wn=(triang(M));
  643. n = -(M-1)/2:(M-1)/2;
  644. fc = wc/(2*pi);
  645. hd = 2*fc*(sinc(2*fc*n));
  646.  
  647. h=hd.*wn';
  648. [HW,WW] = freqz(h,1);
  649.  
  650. subplot(2,1,1);
  651. stem(n,wn);
  652. title('Triangular Window 102095004');
  653. xlabel('n-->');
  654. ylabel('W[n]-->');
  655.  
  656. subplot(2,1,2);
  657. plot(WW./pi,abs(HW));
  658. title('Low Pass Filter 102095004');
  659. xlabel('Normalised Freq-->');
  660. ylabel('Magnitude-->');
  661.  
  662. ______________________________________________________________
  663.  
  664. 7a
  665.  
  666. clc;
  667. clear all;
  668. %DEFINING PARAMETERES
  669. wp =input('Enter pass band frequency: ') * pi;
  670. ws =input('Enter stop band frequency: ') * pi;
  671.  
  672. tr_width =abs(ws-wp);
  673. wc = (wp+ws)/2;
  674.  
  675. %DEFINING WINDOW
  676. M = ceil(6.6*pi/tr_width);
  677. wn=(hamming(M));
  678. n = -(M-1)/2:(M-1)/2;
  679.  
  680. fc = wc/(2*pi);
  681. hd = -2*fc*(sinc(2*fc*n));
  682.  
  683. h=hd.*wn';
  684. [HW,WW] = freqz(h,1);
  685.  
  686. subplot(2,1,1);
  687. stem(n,wn);
  688. title('Hamming Window 102095004');
  689. xlabel('n-->');
  690. ylabel('W[n]-->');
  691.  
  692. subplot(2,1,2);
  693. plot(WW./pi,abs(HW));
  694. title('Low Pass Filter 12095004');
  695. xlabel('Normalised Freq-->');
  696. ylabel('Magnitude-->')
  697.  
  698. ______________________________________________________________
  699.  
  700. 7b
  701.  
  702. clc;
  703. clear all;
  704. %DEFINING PARAMETERES
  705. wp =input('Enter pass band frequency: ') * pi;
  706. ws =input('Enter stop band frequency: ') * pi;
  707.  
  708. tr_width =abs(ws-wp);
  709. wc = (wp+ws)/2;
  710.  
  711. %DEFINING WINDOW
  712. M = ceil(6.2*pi/tr_width);
  713. wn=(hanning(M));
  714. n = -(M-1)/2:(M-1)/2;
  715.  
  716. fc = wc/(2*pi);
  717. hd = -2*fc*(sinc(2*fc*n));
  718.  
  719. h=hd.*wn';
  720. [HW,WW] = freqz(h,1);
  721.  
  722. subplot(2,1,1);
  723. stem(n,wn);
  724. title('Hanning Window 102095004');
  725. xlabel('n-->');
  726. ylabel('W[n]-->');
  727.  
  728. subplot(2,1,2);
  729. plot(WW./pi,abs(HW));
  730. title('Low Pass Filter 12095004');
  731. xlabel('Normalised Freq-->');
  732. ylabel('Magnitude-->')
  733.  
  734.  
Advertisement
Add Comment
Please, Sign In to add comment