# Matlab about signal input and triangular wave square wave

2022-02-04 16:56:22

[1] Set a sound signal as input x

,h[n] Set up 4 More than species , Including pulse 、 Quadrangular pulse and triangular pulse ( quadrilateral , The length of the bottom edge of the triangle is 1ms Left or right or 10 Sample left and right ), And draw the waveform , Find out each output y[n] (convolution sum), Draw a picture for comparison and evaluation .
And N=10 The moving average of (moving average) comparison .
[2] Listen to every sound above , Then evaluate each quality ( fundamental tone +5 Kind of ).

Take the answer ：

Hello , First of all, there must be a signal , I am using matlab The default Hallelujah song

``t = 0:1:10;impulse = t==0;% pulse tri = (t<=5).*(1/5*t)+(t>5).*(1/5*(-t+10));% triangle quadr = t>=0;% quadrilateral tri = tri/sum(tri);% Triangle normalization quadr = quadr/sum(quadr);% Tetragonal normalization load handel.maty_1 = conv(y, impulse,'same');%  Pulse convolution y_2 = conv(y, tri,'same'); % Triangular convolution y_3 = conv(y, quadr,'same'); % Quadrilateral convolution y_4 = movmean(y,10,'Endpoints','discard');% Moving average %  Now play four pieces of audio ( If you don't play, comment out with a percent sign first , Remove the percent sign when playing )sound(y_1,Fs); sound(y_2,Fs);sound(y_3,Fs);sound(y_4,Fs);``

Helpful, hope to adopt , Thank you first