首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用MATLAB绘制三角信号及其傅里叶变换

用MATLAB绘制三角信号及其傅里叶变换
EN

Stack Overflow用户
提问于 2017-04-06 21:45:43
回答 1查看 1.7K关注 0票数 0

对于矩形脉冲,我有以下代码:

代码语言:javascript
复制
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中计算它,或者手动评估它?

EN

回答 1

Stack Overflow用户

发布于 2017-04-07 00:36:57

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

拜托,试着像这样改变你的时间周期。

代码语言:javascript
复制
t=[-100:dt:100];

在三角信号方面,我认为brainkz的评论是最好的。

在你的情况下,请像这样改变你的时间信号。

代码语言:javascript
复制
x=0.5*max(10-abs(t),0);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43266298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档