How do I plot this simple function in matlab
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Wayne King
am 2 Nov. 2012
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))');
Weitere Antworten (1)
Azzi Abdelmalek
am 2 Nov. 2012
Bearbeitet: Azzi Abdelmalek
am 2 Nov. 2012
x=rand(100,1) % eg
y=fft(x)
plot(abs(y))
why real(y)?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!