how to plot the signal maintained in frequency domain in 3d i tried but as you can see its not what i want :(

조회 수: 6 (최근 30일)
t=-10:0.1:10;
C=0;
t0=1;
T=t/t0;
A=1+(1i.*C);
fymax=4.5.*pi;
B=T.^2;
ut=exp((-0.5.*A.*B)+(4.5i*pi*exp(-A.*B)));
%-----figure 1--------------
plot(t,abs(ut))
xlabel('normalized time')
ylabel('spectral intensity')
% -----figure 2------------
figure
I=fftshift(fft(ut));
S=I.^2;
plot(abs(S))
xlabel('normalized frequency')
ylabel('spectral intensity')
%%%%
figure
z=-10:0.1:10;
plot3(z,t,S)
grid on
axis square

답변 (2개)

Walter Roberson
Walter Roberson 2013년 12월 6일
You didn't say anything about what you want it to look like.
Your C is a scalar, so A is a scalar.
Your t0 is a scalar, your t is a vector, so T is a vector, so your B is a vector.
A.*B is scalar times vector, so it is a vector, so both sides of the "+" in the exp() are vectors. So ut is a vector.
With ut being a vector, fft(ut) is a vector, fftshift() of a vector is a vector, so I is a vector. Vector individually squared is vector so S is a vector.
Your z is a vector. Your t is a vector. Your S is a vector. Therefore your plot3() will be a single 3D line, not a surface or a series of mesh lines. Your plot3() is not gaining any visualization power relative to plot(), as the value being plotted (S) in no way depends upon z.
  댓글 수: 1
abed
abed 2013년 12월 6일
ok let me ask y ou something different if i want the values of the frequency obtained due to fft but i only have the given as shown in the code the time can i obtain the values of the frequency after the fft?? can u tell me how??

댓글을 달려면 로그인하십시오.


Wayne King
Wayne King 2013년 12월 6일
편집: Wayne King 2013년 12월 6일
"ok let me ask y ou something different if i want the values of the frequency obtained due to fft but i only have the given as shown in the code the time can i obtain the values of the frequency after the fft?? can u tell me how??"
t=-10:0.1:10;
t0=1;
T=t/t0;
A=1+(1i.*C);
B=T.^2;
ut=exp((-0.5.*A.*B)+(4.5i*pi*exp(-A.*B)));
subplot(211)
plot(t,real(ut)); title('Real Part - ut');
subplot(212)
plot(t,imag(ut)); title('Imaginary Part - ut');
Your signal ut is sampled at time intervals of 0.1 (seconds), so that means the DFT will be periodic in frequency with a period of 10 Hz. The frequency increment (spacing) between the DFT bins is Fs/N where Fs is the sampling frequency - here 10 Hz and the length of the input signal, ut.
figure;
udft = fftshift(fft(ut));
dt = 0.1;
df = 1/(length(ut)*dt);
Fs = 1/dt;
freqvec = -Fs/2+df:df:Fs/2;
plot(freqvec,abs(udft));
xlabel('Hz'); ylabel('|U(f)|');
  댓글 수: 5
Walter Roberson
Walter Roberson 2013년 12월 7일
Please post the current version of your code. The code you have above does not use fymax after it is created.
abed
abed 2013년 12월 7일
t=-10:0.1:10;
C=0;
t0=1;
T=t/t0;
A=1+(1i.*C);
fymax=1i;
B=T.^2;
ut=exp((-0.5.*A.*B)+(z*exp(-A.*B)));
%-----figure 1--------------
plot(t,abs(ut))
xlabel('normalized time')
ylabel('spectral intensity')
% -----figure 2------------
figure
I=fftshift(fft(ut));
S=I.^2;
plot(abs(S))
xlabel('normalized frequency')
ylabel('spectral intensity')
%%%%
figure
z=-1:0.1:1;
dt = 0.1;
df = 1/(length(ut)*dt);
Fs = 1/dt;
f= -Fs/2+df:df:Fs/2;
plot3(z,f,S)
grid on
axis square

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by