I got stuck with the when trying to plot using ezplot

clc;
clear all;
close all;
syms x w
X = (sin(w))/w;
X1 = ifourier(X)
x = -10:0.01:10;
X1 = -(pi*heaviside(x - 1) - pi*heaviside(x + 1))/(2*pi);
figure (1)
ezplot (X1,[-10 10]);
title ('ezplot');
figure (2)
plot(x,X1);
title ('plot');
Hi, I'm new to Matlab since I want to plot the inverse Fourier transform of the signal X(ω) = sin(ω)/ ω using both plot and ezplot, I got the plot part but the ezplot keep giving the error that ' Input must be a character vector expression, function name, function handle, or INLINE object.' Please help

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 1 日

0 投票

There are some mistakes in your code. Check the following code
clc;
clear all;
close all;
syms x w
X = (sin(w))/w;
X1 = ifourier(X);
x = -10:0.01:10;
X2 = -(pi*heaviside(x - 1) - pi*heaviside(x + 1))/(2*pi);
figure (1)
ezplot (X1,[-10 10]);
title ('ezplot');
figure (2)
plot(x,X2);
title ('plot');
Note, ezplot() is depreciated. It is better to replace it with fplot().

4 件のコメント

Duy Dang
Duy Dang 2020 年 11 月 2 日
the problem ask that I need to use ezplot to plot so is there any ways?
Ameer Hamza
Ameer Hamza 2020 年 11 月 2 日
The code in my answe use ezplot(). Have you tried running it?
Duy Dang
Duy Dang 2020 年 11 月 2 日
my bad
Ameer Hamza
Ameer Hamza 2020 年 11 月 2 日
No Problem! I am glad to be of help!!!

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

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

2020 年 11 月 1 日

コメント済み:

2020 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by