decimation and interpolation in matlab

2
clc; clear all; close all; x=input('Enter sequence:'); N=length(x); ch=input('1. decimation 2.interpolation...enter choice:'); switch(ch) case 1 n=input('Enter decimation actor:'); m=ceil(N!n); "=#eros(1$m); %=1; or i=1:m i(%&=N) "(1$i)=x(1$%); end %=% n; end disp("); case 2 n=input('Enter no. o interpolated #eros:'); N1=N (n 1) N; "=#eros(1$N1); i=1; %=1; while i&=N1 *=1; while(*&n); "(1$i)=+; i=i 1;*=* 1; end i(%&=N) "(1$i)=x(1$%); end %=% 1; i=i 1; end disp("); end

Upload: monicaedu

Post on 04-Nov-2015

22 views

Category:

Documents


0 download

DESCRIPTION

Matlab code for decimation and interpolation.

TRANSCRIPT

clc; clear all; close all;x=input('Enter sequence:');N=length(x);ch=input('1. decimation 2.interpolation...enter choice:');switch(ch) case 1n=input('Enter decimation factor:');m=ceil(N/n);y=zeros(1,m);k=1;for i=1:m if(k