How do I plot this simple function in matlab
1 回表示 (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
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 件)
Azzi Abdelmalek
2012 年 11 月 2 日
編集済み: Azzi Abdelmalek
2012 年 11 月 2 日
x=rand(100,1) % eg
y=fft(x)
plot(abs(y))
why real(y)?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!