フィルターのクリア

Matlab doesn't run

1 回表示 (過去 30 日間)
Tu Nguyen
Tu Nguyen 2022 年 3 月 1 日
コメント済み: Torsten 2022 年 3 月 1 日
clc;
close all;
clear all;
syms w;
n = -5:0.01:5;
x21 = exp(-abs(n));
X_21= sum(x21.*exp(-j*w*n));
figure (2)
subplot(5,1,1);
fplot(@(w) abs(X_21), [-2*pi 2*pi]);
grid on
Can anyone please check this code, it doesn't run on my laptop?

採用された回答

Walter Roberson
Walter Roberson 2022 年 3 月 1 日
I was timing out on this Answers facility going from -5 to +5 for demonstration purposes; you would change L for your purposes.
syms w;
L = 1.1;
n = -L:0.01:L;
x21 = exp(-abs(n));
X_21= sum(x21.*exp(-j*w*n));
F = matlabFunction(abs(X_21));
fplot(F, [-2*pi 2*pi]);
grid on
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 1 日
It takes quite a long time with L = 5.
Torsten
Torsten 2022 年 3 月 1 日
I wonder why people that often use symbolic variables although they only want to perform numerical calculations.

サインインしてコメントする。

その他の回答 (1 件)

Torsten
Torsten 2022 年 3 月 1 日
n = -5:0.01:5;
x21 = exp(-abs(n));
X_21= @(w) sum(x21.*exp(-j*w*n),2);
w = linspace(-2*pi,2*pi,100).';
plot(w,abs(X_21(w)));
  1 件のコメント
Tu Nguyen
Tu Nguyen 2022 年 3 月 1 日
Thank you so much

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by