您好,欢迎访问三七文档
下面的MATLAB程序以三维形式演示欧拉公式Exp(t)=cos(t)+jsin(t)%%本程序演示欧拉公式%Jan.25th,2012%h_fig1=figure;set(h_fig1,'unit','normalized','position',[0.1,0.1,0.9,0.9]);set(h_fig1,'defaultuicontrolunits','normalized');h_text1=uicontrol(h_fig1,'Style','text','Position',[0.71,0.73,0.25,0.05],...%创建文本框'String','▲是cos曲线的起点','ForegroundColor','r','FontName','黑体',...'FontSize',12,'FontWeight','Bold','BackgroundColor',[1,1,1]);h_text2=uicontrol(h_fig1,'Style','text','Position',[0.71,0.78,0.25,0.05],...%创建文本框'String','Δ是sin和exp曲线的起点','ForegroundColor','r','FontName','黑体',...'FontSize',12,'FontWeight','Bold','BackgroundColor',[1,1,1]);h_pushbutton1=uicontrol(h_fig1,'Style','PushButton','Position',[0.82,0.12,0.07,0.06],...'string','退出','BackgroundColor',[0.80.90.8],'ForegroundColor','r','FontSize',14,'FontWeight','Bold',...'callback','delete(h_fig1),')h_axes0=axes('Box','on','Position',[0.15,0.18,0.56,0.68],'FontSize',8)set(gcf,'color','w');w=0.1*pit=0:40;%在前进方向绕了2圈%a=-ones(1,length(t));plot3(cos(w*t),t,sin(w*t),'b','LineWidth',2);gridon;holdon;hc=plot3(cos(w*t),t,a,'k--');holdon;set(hc,'Color','r','LineWidth',2);a=-a;hs=plot3(a,t,sin(w*t),'r-.');holdon;set(hs,'Color','k','LineWidth',2);text(0.7,0.3,0.6,'--CCW','FontSize',14,'FontWeight','Bold');text(1,0,-1,'▲Cos','Color','r','FontSize',14,'FontWeight','Bold');text(1,0,0,'ΔSin','FontSize',14,'FontWeight','Bold');%xlabel('x','FontSize',14,'FontWeight','Bold');ylabel('t','FontSize',14,'FontWeight','Bold');zlabel('y','FontSize',14,'FontWeight','Bold');title('演示欧拉公式y=exp(jwt)=cos(wt)+jsin(wt)','Color','b',…'FontSize',18,'FontWeight','Bold');%line([-1,-1],[39.9,39.9],[-1,1],'LineWidth',3,'Color','r');line([1,1],[39.9,39.9],[-1,1],'LineWidth',3,'Color','r');line([-1,-1],[0,0],[-1,1],'LineWidth',3,'Color','r');line([1,1],[0,0],[-1,1],'LineWidth',3,'Color','r');line([-1,-1],[0,40],[-1,-1],'LineWidth',3,'Color','k');line([-1,1],[0,0],[-1,-1],'LineWidth',3,'Color','b')line([-1,1],[40,40],[1,1],'LineWidth',3,'Color','b')line([-1,1],[40,40],[-1,-1],'LineWidth',3,'Color','b')line([-1,1],[0,0],[1,1],'LineWidth',3,'Color','b')line([-1,1],[0,0],[0,0],'LineWidth',2,'Color','k');line([0,0],[0,0],[-1,1],'LineWidth',2,'Color','k');line([0,0],[40,40],[-1,1],'LineWidth',2,'Color','k');line([0,0],[0,40],[0,0],'LineWidth',2,'Color','k');line([-1,1],[40,40],[0,0],'LineWidth',2,'Color','k');line([0,0],[0,40],[0,0],'LineWidth',2,'Color','k');text(0,0,0.12,'O','FontSize',14,'FontWeight','Bold','Color','r')text(0,40,0.12,'O','FontSize',14,'FontWeight','Bold','Color','b')程序运行结果如下所示。按下工具条的Tool|Rotate3D选项,用鼠标带动上述的图形,可以任意改变视角。
本文标题:欧拉公式的三维演示
链接地址:https://www.777doc.com/doc-4874962 .html