教你用Matlab畫一個單值複函數
02-10
MATLAB除了當女朋友之外基本是萬能的,但是我居然找不到類似於maple的complexplot3d()函數,如何實現相同的功能呢?
function [h] = cplxplot3(X,Y,F)%This function plots a 3d image for single-complex-valued function.%% Example 1:% % [X,Y]=meshgrid(-pi:0.1:pi);% Z=X+1i*Y;% F=sin(Z);% cplxplot3(X,Y,F);%% Example 2:% [X,Y]=meshgrid(-3:0.02:3);% Z=X+1i*Y;% F=sech(Z);% h=cplxplot3(X,Y,F);set(h,edgecolor,none);% xlabel(Re(z));ylabel(Im(z));zlabel(|f(z)|);% title(f(z)=sech(z));%H=abs(F);Arg=pi*sawtooth(angle(F)+pi);h=surf(X,Y,H,Arg);grid oncolormap(hsv);cbr=colorbar;caxis([-pi,pi]);set(cbr,Ytick,[-pi,-pi/2,0,pi/2,pi],Yticklabel,{-pi,-pi/2,0,pi/2,pi});end
推薦閱讀:
※matlab做量化投資分析,怎麼學?
※推崇Mathematica的那些人,理由是什麼?
※金融學專業,需要學習哪些軟體/編程語言?