数模matlab操作

来源:互联网 发布:python在线运行 编辑:程序博客网 时间:2024/05/16 07:11

1、 建立test.m文件,基础操作示例:

%test%代表注释clear%清空所有内存变量clc%清屏clf     %clear figure 消窗口syms x y;%syms 定义变量,不加";",就会在屏幕上显示此行的结果for i = 1:1:10……end
help quad<span style="white-space:pre"></span>%help integral

2、函数文件

function F = V(H)% V 为名字,H为传入参数…………F = ……end


3、代码示例

<pre name="code" class="plain">clear;clc;x = -5:0.1:5;y1 = x+10;y2 = x.^2;hold on% 原始曲线% plot(x,y1);% plot(x,y2);% 散点图% plot(x,y1,'*');% plot(x,y2,'o');% 控制横坐标、纵坐标的范围% plot(x,y1);% plot(x,y2);% axis([-10,10,-10,30]);% 加粗,变色% plot(x,y1,'linewidth',1.5);% plot(x,y2,'r');% 添加标题、横纵坐标注释% plot(x,y1);% plot(x,y2);% title('一次函数和二次函数');% xlabel('自变量x');% ylabel('因变量y');% 修改标题、横纵坐标注释的大小% plot(x,y1);% plot(x,y2);% title('一次函数和二次函数','fontsize',20);% xlabel('自变量x','fontsize',17);% ylabel('因变量y','fontsize',17);% 在曲线旁加注释% plot(x,y1);% plot(x,y2);% text(0.7,10,'\fontsize{14}\it y1 = x+10');% text(2.7,6,'\fontsize{14}\it y2 = x^2');% 添加图例注释% plot(x,y1);% plot(x,y2);% legend('\fontsize{14}\it y1=x+10','\fontsize{14}\it y2=x^2');% 图例注释的位置% plot(x,y1);% plot(x,y2);% legend('\fontsize{14}\it y1=x+10','\fontsize{14}\it y2=x^2',2);% % legend('\fontsize{14}\it y1=x+10','\fontsize{14}\it y2=x^2',3);% % legend('\fontsize{14}\it y1=x+10','\fontsize{14}\it y2=x^2',4);% 画子图% subplot(1,2,1);% plot(x,y1);% subplot(1,2,2);% plot(x,y2);% % % subplot(2,1,1);% % plot(x,y1);% % subplot(2,1,2);% % plot(x,y2);% 综合%     %子图1% subplot(1,2,1);% plot(x,y1,'r*');% title('一次函数','fontsize',20);% xlabel('自变量x','fontsize',17);% ylabel('因变量y','fontsize',17);% text(0.7,10,'\fontsize{14}\it y1 = x+10');% legend('\fontsize{14}\it y1=x+10');%     %子图2% subplot(1,2,2);% plot(x,y2,'linewidth',1.5);% title('二次函数','fontsize',20);% xlabel('自变量x','fontsize',17);% ylabel('因变量y','fontsize',17);% text(2.7,6,'\fontsize{14}\it y2 = x^2');% legend('\fontsize{14}\it y2=x^2');



以上主要为算法模块内容,还有很多很多内容在ppt中,以及可以百度得到。

注意使用spss求分布和Maple求积分。


0 0
原创粉丝点击