![matlab经典的小程序_第1页](http://file4.renrendoc.com/view/3ffdba7bc80082afd78afd425db9cae5/3ffdba7bc80082afd78afd425db9cae51.gif)
![matlab经典的小程序_第2页](http://file4.renrendoc.com/view/3ffdba7bc80082afd78afd425db9cae5/3ffdba7bc80082afd78afd425db9cae52.gif)
![matlab经典的小程序_第3页](http://file4.renrendoc.com/view/3ffdba7bc80082afd78afd425db9cae5/3ffdba7bc80082afd78afd425db9cae53.gif)
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Num2str变数值为字符串Int2str变整数为字符串Str2num变字符串为数值Sprintf变数值为格式控制下的字符串Sscanf变字符串为格式控制下的数值.分段函数for x=-pi*6:pi/10:6*pi y=sin(x);if y0y=0;endfprintf(x=%f,y=%fn,x,y);end.计算距离x1=input(enter the x1:);y1=input(enter the y1:);x2=input(enter the x2:);y2=input(enter the y2:);d=sqrt(x1-x2)A2+(y1-y2)A2);fprintf(the dis
2、tance of the two points is :%f,d);v0=input(Enter the初速度 v0:);h0=input(Enter the离地高度 h0:);t=0:0.01:5.重力加速度h=-0.5*9.81*t.A2+v0*t+h0;v=-9.81*t+v0;plot(t,h,k-,t,v,b-);title( Plot of h(t) and v(t);xlabel(t);ylabel(h(t)andv(t);legend(h(t),v(t);.坐标转换function x, y = polar2rect(r, theta)x = r * cos(theta * p
3、i/180);y = r * sin(theta * pi/180);坐标转换,带参数检验function mag, angle = polar_value(x, y)msg = nargchk(1,2,nargin);error(msg);% If the y argument is missing, set it to 0.if nargin 2y = 0;end% Check for (0,0) input argument, and print out% a warning message.if x = 0 & y = 0msg = Both x and y are zero: ang
4、le is meaningless!; warning(msg);end% Now calculate the magnitudemag = sqrt(x .A2 + y .A2);% If the second output argument is present,calculate% angle in degreesif nargout = 2angle = atan2(y,x) * 180/pi;end三维螺旋线t = 0:pi/50:10*pi;plot3(sin(t),cos(t),t)grid onaxis square7.subplotfigure(1);subplot(2,1,
5、1);x=-pi:pi/20:pi;y=sin(x);plot(x,y);title(Subplot 1 title); subplot(2,1,2);x=-pi:pi/20:pi;y=cos(x);plot(x,y);title(Subplot 2 title); Figurefigure(1);x=x:0.05:2;y1=exp(x);plot(x,y1);figure(2);y2=exp(-x);plot(x,y2);. 保持x=-pi:pi/20:pi;y1=sin(x);y2=cos(x);plot(x,y1,b-);hold on;plot(x,y2,k-);hold off;legend (sin x,cos x);. 极坐标绘图g = 0.5;theta = 0:pi/20:2*pi;gain = 2*g*(1+cos(theta);% Plot gainpolar (theta,gain,r-);title (Gain versus angle ittheta);.色彩控制x=0:pi/15:4*pi;y=exp(2
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电商平台物流配送外包协议
- 新一代智慧城市物流规划与建设方案研究
- 遥控无人机航拍合同
- 建筑工地施工安全责任与风险免责协议
- 五保户照料协议书
- 基金投资行业保密协议
- 合作居间费的合同
- 天然气工程施工合同
- 物流园区投资开发合同
- 人教版五年级下册数学求最大公因数练习200题及答案
- 红楼梦英文版(杨宪益译)
- 初三开学第一课家长会优秀课件两篇
- 马工程教材《公共财政概论》PPT-第十四章 国际财政
- 狮子王1中英文台词
- 《大学俄语》教学大纲
- 清淤工程施工记录表
- 2022年涉农领域涉嫌非法集资风险专项排查工作总结
- 起重装卸机械操作工国家职业技能标准(2018年版)
- 五年级下册美术课件-第2课 新街古韵丨赣美版
- 秦荻辉科技英语写作教程练习答案(共42页)
- GB∕T 41168-2021 食品包装用塑料与铝箔蒸煮复合膜、袋
评论
0/150
提交评论