フィルターのクリア

How do I plot this simple function in matlab

1 回表示 (過去 30 日間)
Poonam
Poonam 2012 年 11 月 2 日
I have a function f(x) = +i x>0;
= 1 x=0;
= -i x<0 ;
I am confused because of the existence of the complex number. Suppose I want to take the fourier transform of this function. I do y=fft(f(x)); plot(x,real(y)); Is this right?

採用された回答

Wayne King
Wayne King 2012 年 11 月 2 日
Did you simply want to plot that complex-valued function of a real variable, f(x), you can do that with stem3
x= -50:50;
y = zeros(size(x));
y(x<0) = -1i;
y(x>0) = 1i;
y(x==0) = 1;
stem3(x,real(y),imag(y))
xlabel('x'); ylabel('Re(f(x))'); zlabel('Imag(f(x))');
  1 件のコメント
Poonam
Poonam 2012 年 11 月 2 日
Hi,
I loved the way you plotted it. Thank you. I would like to know if I could combine the 3 conditions of y and put into one equation. I actually want to multiply this with another function and take the FFT of it? How could I do that?

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

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 2 日
編集済み: Azzi Abdelmalek 2012 年 11 月 2 日
x=rand(100,1) % eg
y=fft(x)
plot(abs(y))
why real(y)?

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by