何必手算?Matlab求解傅里葉變換|Matlab符號(hào)計(jì)算


clc %清屏
close all %關(guān)閉窗口
clear %清理工作空間
%定義符號(hào)變量
syms A t w
syms a positive
%使用階躍信號(hào)合成方波信號(hào)
f = heaviside(t+a) - heaviside(t-a);
G = fourier(A*f); %進(jìn)行傅里葉變換
g = simplify(G); %公式化簡(jiǎn)
symdisp(g) %公式顯示
%圖像繪制
f = subs(f, a, 3);
g = subs(g, [A a], [1 3]);
subplot(2, 1, 1); %設(shè)置子圖1
fplot(f, [-10 10], "LineWidth", 2);
grid on;
subplot(2, 1, 2); %設(shè)置子圖2
fplot(abs(g), "LineWidth", 2);
ylim([0 8]);
grid on;
標(biāo)簽: