i want the program to advance or delay the signal… by taking input from user whether to advance or delay & by what number?…. please use switch statement?…. any signal like-ramp,step,exponential in it i am using subplot to plot the original signal & shifted version of the signal..
i have a program something like this--*clear allclose allclcdisp('given function is')x=(-10:10);for i=1:1:21if(x(i)>0) y(i)=exp(x(i));else y(i)=0;endendsubplot(1,2,1)stem(x,y)disp('enter whether to advance or delay')s=input('1>advance\n 2>Delay')n=input('enter the no of step by which signal is to be shifted')switch(s)case 1 [ for i=1+n:1:21+n if(x(i)>0) y(i)=1; else y(i)=0; end ]case 2 [ for i=1-n:1:21-n if(x(i)>0) y(i)=1; else y(i)=0; end ]subplot(1,2,2)stem(x,y)
but when i run the program it gives error in the 'for' command in case 1.
Best Answer