大家帮忙指正 一下
刚刚学matlab有关数字信号处理的部分,做了几道题,大家帮忙看一下还有改进的地方没有,谢谢咯1.Write a MATLAB program to compute and plot the response of input as and a causal finite-dimensional discrete-time system characterized by a difference equation of the following form:y[n]+0.3y[n-1]+0.5y[n-2]-0.72y[n-3]=1.8x[n]+0.34x[n-1]-1.32x[n-2]-0.86x[n-3]
solution:
b=[1.8,0.34,-1.32,-0.86];
>> a=[1,0.3,0.5,-0.72];
>> [h,t]=impz(b,a,31);
>> n=0:30;
>> x=cos(0.2*pi*n);
>> y=conv(x,h);
>> plot(y);
这个地方有一点不会,它要求前31个响应,应该怎么弄啊?
另外,我看过差分方程的一种解法,里面给出了y[-1],y[-2],x[-1],x[-2]的值,然后用的filtic求的,这样的没有给y[-1],y[-2],x[-1],x[-2]值的题能不能用那种方式求解啊
2.Writing a MATLAB program to compute the linear convolution of two length-N sequences. Using this program to determine the following pair of sequences:
g[n]={1+j4, 6-3j, 0, 3, -j4}, h[n]={-3-j2, -1, 1+j2, 6+j3, 1-j2} 0<=n<=4
solution:
N=input('please input the lenth of the two sequence\n');
g=input('\nplease input a sequence');
h=input('\nplease input a sequence');
y=conv(g,h);
3.Write a MATLAB program to compute and plot the impulse response of a causal finite-dimensional discrete-time system characterized by a transfer function of the following form: H(Z)=1-3.5Z^-1+4.9Z^-2-3.43Z^-3+1.2005Z^-4-0.16807Z^-5
solution
%From the expression we know y[n]=x[n]-3.5x[n-1]+4.9x[n-2]-3.43x[n-3]+1.2005x[n-4]-0.16807x[n-5];
b=[1,-3.5,4.9,3.43,1.2005,-0.16807];
a=[1];
[h,t]=impz[b,a,41];