绘制三角形信号并在MATLAB中找到其傅里叶变换

时间:2017-04-06 21:45:43

标签: matlab fft

我有矩形脉冲的以下代码:

clear all
dt=.001;
t=[-25:dt:25];
x=(5/2)*(sign(t+10)-sign(t-10));
%subplot(2,2,1);
plot(t,x);
title('Rectangular pulse with width 10ms');
xlabel('time(ms)');
ylabel('Amplitude(V)');
axis([-25 25 0 6]);
>> y=fftshift(fft(x));  % moving the zero-frequency component to the center of the array
N=length(y);         %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2;  %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.

title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');

plot(n,f);  
axis([-50 50 0 150000]); 
>> 
>> y=fftshift(fft(x));  % moving the zero-frequency component to the center of the array
N=length(y);         %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2;  %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.

title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');

plot(n,f);  
axis([-50 50 0 150000]);

如何获得三角脉冲?

此外,上述代码没有找到矩形信号的傅里叶变换。怎么找到它?如何找到三角形信号?是否可以在MATLAB中计算它或手动评估它?

1 个答案:

答案 0 :(得分:0)

时间信号的长度应足够长,以便在频域上获得适当的分辨率。

请尝试改变这样的时间段。

this[i].update is not a function

就三角信号而言,我认为,brainkz的评论是最好的。

在您的情况下,请更改您的时间信号。

t=[-100:dt:100];