3D suface plot

5 views (last 30 days)
Fabrice shao
Fabrice shao on 23 Oct 2018
Commented: Fabrice shao on 23 Oct 2018
Dear all, how can I plot 3D to analyzed the pulse propagating in the frequency domain. Please refer to the figure (7) which only allow me to plot 2D. Please see my code. here is my code. P
LEASE SEE THE 3D ATTACHED
if true
clear;
% p0=2;Input power in (w)
p0=6
% p0=5
T1=5;% Pulse with
T0=T1/2/sqrt(log(2));%(FWHM)
h=1;%²½³¤
% gama=2.90
% for gama=[1.20, 2.90 ,3.1]
% gama = 2:0.1:10;gama=[1.20,2.90,3.1,4.4,5.3];
% gama=[1.20,2.90,3.1,4.4,5.3];
for gama=[1.20,2.90,3.1,4.4,5.3];
% do operations
% Plot();
hold on;
end
beta=0;%%second order dispersion
T=0.3;% total pulse with (TFWHM)
N=285;% Soliton order
n=-N/2:(N/2-1);
t=n.*T;% order
uszgz0=exp(-t.^2./(2*T0^2));
usz=exp(-t.^2./(2*T0^2));% Dispersion
A0=sqrt(p0)*uszgz0;% Amplitude
dfait=1/T0*h*gama*p0*(t/T0).*exp(-(t/T0).^2);
for k=1:10
u0=usz;
usz=abs(u0).*exp(-h*j*gama*p0*(abs(u0).^2));%first order with Chirp parameter
fusz=fftshift(fft(usz));% Spectrum
end
f=(0:(N-1))./(N*T)*1e3-1/(2*T)*1e3;
Az=usz*sqrt(p0);%
% figure (1)
% plot(t,A0.^2,'g');
hold on
figure (100)
plot(t,A0.^2,'b-o',t,A0.^2,'r.-','Linewidth',6)
title('Pulse Evolution');
xlabel('Time (ps) ');
ylabel('Power(W)');
set(gca,'FontSize',24);
legend ('Matlab IN','After SPM');
legend boxon
grid on;
xlim([-10,10])
% figure (2);
% plot(t,(abs(Az).^2),'b');%´«ÊäLºóÐźŹ¦Âʲ¨ÐÎ*2/N
% plot (3)
% plot(f,fftshift((T*abs(fft(uszgz0))).^2)/N,'g');%³õʼÐźŹ¦ÂÊÆ×
% figure (4)
% plot(f,(T*(abs(fusz))).^2/N,'b','Linewidth',4);%´«²¥100kmºóµÄÐźŹ¦ÂÊÆ×
% title('Pulse Evolution');
% xlabel('Wavelenght(u) ');
% ylabel('Power (W)');
% set(gca,'FontSize',24);
% legend ('Wavelenght');
% % legend boxon
% % grid on;
% % xlim([-800,800])% figure (5)
% plot(t/T0,dfait,'g');%ÀíÂÛßúà±
% figure (6)
% plot(t(2:N)/T0,diff(angle(usz))/T,'b');%ʵ¼Ê·ÂÕæßúà±
figure (7)
plot(f,fftshift((T*abs(fft(uszgz0))).^2)/N,'g','Linewidth',6)
hold on
plot(f,(T*(abs(fusz))).^2/N,'b','Linewidth',4)
title('Pulse Evolution');
xlabel(' Frequency (GHz)');
ylabel('Power (W)');
set(gca,'FontSize',24);
legend ('Matlab IN','After SPM');
% legend ('1m','2m','3m','4m','5m');
legend boxon
grid on;
xlim([-900,900])
grid on
end

Accepted Answer

KSSV
KSSV on 23 Oct 2018
figure
x = f ;
y = fftshift((T*abs(fft(uszgz0))).^2)/N ;
N = length(y) ;
t = linspace(-2,2,N) ;
d = linspace(0,10,N) ;
[T,D] = meshgrid(t,d) ;
P = repmat(y,N,1) ;
surf(T,D,P) ;
shading interp
  2 Comments
Fabrice shao
Fabrice shao on 23 Oct 2018
thank you so much, this is in the time domain, it possible to make it in the frequency domain? where we use the inverse of Fourier transform ifftshit.
thank you so much
Fabrice shao
Fabrice shao on 23 Oct 2018
can you please check this code as well, following your scheme. thank you for support
figure (9)
x1=f;
y1=(T*(abs(fusz))).^2/N
N= length(y) ;
t = linspace(-2,2,N)
d = linspace(0,10,N) ;
[T,D] = meshgrid(t,d) ;
P = repmat(y,N,1) ;
surf(T,D,P) ;
shading interp
end

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!