福尔摩妍 2021-08-03 11:17 采纳率: 100%
浏览 673
已结题

用MATLAB编写rect函数表示结构

clear all
close all
clc;
TransPoint=[0.0509586,0.1013709,0.4542960];        
TransPoint_position=TransPoint;
a=(TransPoint_position(3)+TransPoint_position(1))/2;
b=TransPoint_position(3)-TransPoint_position(1);
x=-0.4033374:0.0001:0.4033374;
t=rectpuls((x-a)/b);
y=fft(t); %傅里叶变换函数
plot(abs(y));

想生成周期型的矩形函数,高度设置为pi

  • 写回答

1条回答 默认 最新

  • CSDN专家-Matlab_Fans 2021-08-03 23:15
    关注

    使用repmat函数重复矩阵,生成周期方波即可。代码:

    
    clear all
    close all
    clc;
    TransPoint=[0.0509586,0.1013709,0.4542960];        
    TransPoint_position=TransPoint;
    a=(TransPoint_position(3)+TransPoint_position(1))/2;
    b=TransPoint_position(3)-TransPoint_position(1);
    x=-0.4033374:0.0001:0.4033374;
    t=rectpuls((x-a)/b);
    % Repeat
    X0 = x(end) - x(1);
    X = [x X0+x 2*X0+x  3*X0+x 4*X0+x];
    T = pi*repmat(t,1,5);
    plot(X,T)
    ylim([-0.5 4])
     
    

    结果:

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 8月12日
  • 已采纳回答 8月4日
  • 创建了问题 8月3日

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作