[教学]MATLAB小程序
基于内容的图像检索matlab小程序

基于内容的图像检索matlab小程序基于内容的图像检索matlab小程序,使用图像的9种主要颜色为检索特征。
% RGB retrieval%fid=fopen('ninecolor3_distr.dat','r'); normalized central moments fid=fopen('ninecolor2_distr.dat','r');%fid2=fopen('edge2_radon_svd0.dat','r');%fid1=fopen('edge2_radon_svd90.dat','r');%fid3=fopen('edge2_radon_0org.dat','r');%fid4=fopen('edge2_radon_90org.dat','r');fid2=fopen('ninecolor2_dist.dat','r');PCACOE=10;MU=0.78315;DLT=0.16879;MAX=1.6582;MIN=0;MU1=58.781;DLT1=19.922;MAX1=130.83;MIN1=0;MU2=2.6843;DLT2=0.66799;MAX2=4.5187;MIN2=0;%fid1=fopen('avecolor.dat','r'); %for (i=1:910)% tmp_mom=fread(fid1,10,'float'); % ind12(:,i)=tmp_mom(1:PCACOE); % tmp_mom=fread(fid2,10,'float'); % ind13(:,i)=tmp_mom(1:PCACOE); %end %ind_pca0=ind12';%ind_pca90=ind13';%fclose(fid1);%fclose(fid2);%for (i=1:910)% tmp_mom=fread(fid3,128,'float'); % ind14(:,i)=tmp_mom(1:128); % tmp_mom=fread(fid4,128,'float'); % ind15(:,i)=tmp_mom(1:128); %end %ind_0org=ind14';%ind_90org=ind15';%fclose(fid3);%fclose(fid4);for (i=1:910)hist1(:,i)=fread(fid2,18,'float'); endind_dis=hist1';fclose(fid2);for (i=1:910)hist(:,i)=fread(fid,63,'float'); endind_c=hist';fclose(fid);NULL_seg=[0 0 0 0 0 0 0];isize=910;qi=1;dist1=0;qi=input('Query image no:(1-910 or 0 to quit)');while (qi~=0)qh=ind_c(qi,:);for (cnt=1:910)dist=0;db=ind_c(cnt,:);for (j=1:9)%% L1/L2 Distancestmp_vec=qh((j-1)*7+1:j*7);tmp_vec1=db((j-1)*7+1:j*7);%if ((tmp_vec==NULL_seg)|(tmp_vec1==NULL_seg))%% if (sum(tmp_vec(4:6))~=0) %% angl=1-(2/pi)*acos(abs(tmp_vec(4:6)*tmp_vec1(4:6)'));%% else%% angl=0;%% end%% if (angl<0)%% angl=0;%% end%dist=dist+norm(tmp_vec(1:3)-tmp_vec1(1:3),2)+angl+abs(tmp_vec(7)-tmp_vec1(7));dist=dist+norm(tmp_vec(1:6)-tmp_vec1(1:6),2)+abs(tmp_vec(7)-tmp_vec1(7));%dist=dist+norm(tmp_vec-tmp_vec1,1);end% Distance of SVD coefficients%%dist1=0.5*(norm(ind_pca90(qi,:)-ind_pca90(cnt,:),2)+norm(ind_pca0(qi,:)-ind_pca0(cnt,:),2));%%dist2=0.5*(norm(ind_90org(qi,:)-ind_90org(cnt,:),2)+norm(ind_0org(qi,:)-ind_0org(cnt,:),2));%% New distance%%DIST=0;%% for (k=1:9)%% DIST=DIST+qh(k*7)^2;%5 end%% for (j=1:9)%% DIST=DIST+db(j*7)^2;%% end%% for (k=1:9)% for (j=1:9)% tmp_arr=db((j-1)*7+1:j*7);%% d1=norm(qh((k-1)*7+1:(k-1)*7+6)-tmp_arr(1:6),2); % if (d1>0.08)% a1=0;% else% a1=1-d1/0.096;% end% DIST=DIST-2*a1*qh(k*7)*tmp_arr(7);%dist00(k,j)=norm(query0((k-1)*4+1:(k-1)*4+3)-tmp_arr(1:3),2)+sum(abs(query0(k*4)-tmp_arr(4)));%dist00(k,j)=sum(abs(query0((k-1)*4+1:(k-1)*4+4)-tmp_arr(1:4)));%%dist00(k,j)=norm(query0((k-1)*4+1:(k-1)*4+3)-tmp_arr(1:3),1)+(1-min(query0(k*4),tmp_arr(4))/max(query0(k*4),tmp_arr(4)));%%dist01(k,j)=norm(query0((k-1)*2+1:k*2)-tmp_arr(1:2),2);%dist01(k,j)=norm(ind_ctroid(qi,(k-1)*2+1:k*2)-ind_ctroid(cnt,(j-1)*2+1:j*2),2);%%dist02(k,j)=norm(hsv_pca0(q_no+k-1,:)-hsv_pca0(db_no+j-1,:),2)+norm(hsv_pca90(q_no+k-1,:)-hsv_pca90(db_no+j-1,:),2);%% end%% end%% dist=DIST;dist1=norm(ind_dis(qi,:)-ind_dis(cnt,:),1);%dist=0.0*dist+1.0/1*(dist1-(MU-3*DLT))/(6*DLT);%dist=0.0*dist+1.0/1*(dist1-MIN)/MAX; dist2=0;dist=1.0*(dist-(MU2-3*DLT2))/(6*DLT2)+0.0*(dist1-(MU1-3*DLT1))/(6*DLT1)+0.0*dist2;result(:,cnt)=[dist cnt]';end%查询结果显示format short g;result1=result';%result2(:,1)=result1(:,2);%result2(:,2)=result1(:,1);result2=sortrows(result1);%disp(result2(isize-9:isize,:)); disp(result2(1:10,:));%Display first ten IMAGESpause;%name=input('Search image:','s'); i=0;%figure;rank=1;%for (k=isize:-1:isize-9)wh=figure;set(wh,'Color',[0.8 0.8 0.8]);set(wh,'Units','Normal');set(wh,'Position',[0.05 0.05 0.9 0.8]); set(wh,'MenuBar','none'); for (k=1:50)bmpno=round(result2(k,2)-1);iname=sprintf('f:\\image\\img\\%d.jpg',bmpno);[img map]=imread(iname);if (isrgb(img))[img map]=rgb2ind(img,256);endimg=imresize(img,[200 256]); %[128 128]hdl=subplot(5,10,rank);sv=strcat('',num2str(result2(k,1)));% frno=ceil(k/10);% fcno=mod(k,10);% if (fcno==0)% fcno=10;% end%subimage((frno-1)*0.1,(fcno-1)*0.1,img,map);subimage(img,map);%%set(hdl,'Units','Pixels');%%set(hdl,'Position',[0.05+mod(rank-1,10)*0.09 0.95-(floor((rank-1)/10)+1)*0.18 0.09 0.18]);%%lh=get(hdl,'Xlabel');%%set(lh,'String',sv);set(hdl,'Title',text('String',sv));posxy=get(hdl,'Position');%%set(gcf,'Units','normalized');rfcbox=uicontrol(gcf,'Style','Checkbox','Units','normalized',...'Position',[posxy(1) posxy(2)-0.02 0.086 0.052],...'String','RF=N','CallBack','my_rf');%% ['set(gca,"RF","N"),','if get(rfcbox,"Value")==1,', 'set(gca,"RF","Y"),','end'] 'String','Box=on',...set(hdl,'YTickLabel',[]),set(hdl,'XTickLabel',[]);%set(hdl,'YGrid','off'),set(hdl,'XGrid','off');set(hdl,'YTick',[]),set(hdl,'XTick',[]);set(hdl,'Box','off');rank=rank+1;end%end%flopsqi=input('Query image no:(1-110 or 0 to quit)');end。
matlab小程序

命令窗口:
五、实验结果分析与总结
通过简单实例熟悉 matlab 程序的基本语法,并通过两种方法的表达 实现 MATLAB 程序的简单化及实用化。程序中 MATLAB 的一些基本函数会 极大的增加程序的简单化,所以需要自己掌握些基本的函数。
命令窗口:
方法《2》 :用 switch 语句。 命令文件 file3:
命令窗口:
3、输入 20 个数,求其中最大数和最小数。要求分别用循环结构和调用 MATLAB 的 max 函数 和 min 函数来实现。 方法<1>用循环结构 命令文件 file4:
命令窗口:
方法<2>:调用 MATLAB 的 max 函数和 min 函数 命令文件 file5:
二、实验目的
1.掌握利用if语句,switch语句实现选择结构的方法; 2.掌握利用 for 语句,while 语句实现循环结构的方法; 3.熟悉利用向量运算来代替循环操作的方法并理解 MATLAB 程序设计的特点;
四、实验内容和步骤 1、从键盘输入一个 3 位整数,将它向输出。如输入 639,输出 936。 命令文件 file1:
命令窗口:
4、编写程序,产生 20 个两位随机整数,输出其中小于平均值的偶数。 命令文件:file6
命令窗口:
实验总结:rand()函数为产生随机数函数
x 1 x 3 1 x 1 , 5、计算分段函数的值。 y x e x 1 1 x
命令文件 file7:
命令窗口:
实验总结:fix 函数为取整函数,file1 中 a,b,c 分别为百位、十位、个位数。 2、输入一个百分制成绩,要求输出成绩等级 A、B、C、D、E。其中 90-100 为 A,80-90 为 B,70-79 为 C,60-69 为 D,60 分以下为 E。 要求: (1) 分别用 if 语句和 switch 语句来实现 (2) 输入的百分制成绩后要判断该成绩的合if 语句。 命令文件 file2:
[教学]MATLAB小程序
![[教学]MATLAB小程序](https://img.taocdn.com/s3/m/af7925686f1aff00bfd51e1b.png)
[教学]MATLAB小程序MATLAB小程序1-1.1 描绘出“点”%密度和穗花被害率x=[0,3,10,20,30,40];y1=[0,0.273,2.260,2.550,2.920,3.950];subplot(2,2,1);plot(x,y1);title(' 密度和穗花被害率');xIabelC 头肝八2');ylabel(' 穗花被害率%');%密度和结实率x=[0,3,10,20,30,40];y2=[94.4,93.2,92.1,91.5,89.9,87.9];subplot(2,2,2);plot(x,y2);title(' 密度和结实率');xIabelC 头/m^2');ylabel(' 结实率%');%密度和千粒重x=[0,3,10,20,30,40];y3=[21.37,20.60,20.60,20.50,20.60,20.13];subplot(2,2,3);xIabelC 头/mV);ylabel(' 千重粒g');%密度和减产率x=[0,3,10,20,30,40];y4=[0,2.4,12.9,16.3,20.1,26.8];subplot(2,2,4);plot(x,y4);title(' 密度和减产率');xlabel(' 头/mV);ylabel(' 减产率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06]; subplot(2,2,1);plot(x,y1);title(' 密度和减产率');xIabelC 头/m^2');ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40]; subplot(2,2,2);xIabelC 头肝八2');ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,2 5.16];subplot(2,2,3);plot(x,y3);title(' 密度和减产率');xIabelC 头/m^2');ylabel(' 空壳率%');%进行曲线拟合%密度和穗花被害率x=[0,3,10,20,30,40];y1=[0,0.273,2.260,2.550,2.920,3.950];subplot(2,2,1);p=polyfit(x,y1,4) x=linspace(0,40,40);y=polyval(p,x);plot(x,y);title(' 密度和穗花被害率');xIabelC 头肝八2');ylabel(' 结实率%');%密度和结实率x=[0,3,10,20,30,40];y2=[94.4,93.2,92.1,91.5,89.9,87.9]; subplot(2,2,2);p=polyfit(x,y2,4) x=linspace(0,40,40);y2=polyval(p,x);plot(x,y2);title(' 密度和结实率');xIabelC 头/mV);ylabel(' 结实率%');%密度和千粒重x=[0,3,10,20,30,40];y3=[21.37,20.60,20.60,20.50,20.60,20.13]; subplot(2,2,3);p=polyfit(x,y3,4)x=linspace(0,30,30);y3=polyval(p,x);plot(x,y3);title(' 密度和千粒重');xIabelC 头肝八2');ylabel(' 千重粒g');%密度和减产率x=[0,3,10,20,30,40];y4=[0,2.4,12.9,16.3,20.1,26.8];subplot(2,2,4);p=polyfit(x,y4,4) x=linspace(0,40,40);y4=polyval(p,x)plot(x,y4);title(' 密度和减产率');xlabel(' 头/mV);ylabel(' 减产率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50]; y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06]; subplot(2,2,1);plot(x,y1);title(' 产量损失率');xIabelC 头/mV);ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40]; subplot(2,2,2);plot(x,y2);title(' 卷叶率');xIabelC 头肝八2');ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,25.16]; subplot(2,2,3);plot(x,y3);title(' 空壳率');xlabel(' 头/mV);ylabel(' 空壳率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06];subplot(2,2,1);title(' 产量损失率');xIabelC 头肝八2');ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40];p=polyfit(x,y1,4)x=linspace(0,115,30);y=polyval(p,x);plot(x,y);subplot(2,2,2);p=polyfit(x,y2,4) x=linspace(0,115,30);y=polyval(p,x);plot(x,y) title(' 卷叶率');xIabelC 头/mV);ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,2 5.16];subplot(2,2,3);p=polyfit(x,y1,4)x=linspace(0,115,30);y=polyval(p,x);plot(x,y);title(' 空壳率');xIabelC 头肝八2');ylabel(' 空壳率%')题 1.3 代码%x为臭氧持续作用时间,y为病虫害经臭氧处理时的剩余数量比例,%z%臭氧喷嘴出口处检测到的臭氧浓度x=[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5];y=[93,89,64,35,30,25,18,10,0,0,0];z=[0.15,0.40,0.75,1.00,1.25,1.50,1.80,2.10,2.25,2.65,2.85]; plot3(x,y,z,'m');text(0,0,0,'origin');xlabel(' 小时'),ylabel(' 病虫剩余数量比例%'),zlabel(' 臭氧喷嘴出口处检测到的臭氧浓度'),grid;title(' 臭氧浓度与真菌作用');进行曲线拟合%x为臭氧持续作用时间,y为病虫害经臭氧处理时的剩余数量比例,%z%臭氧喷嘴出口处检测到的臭氧浓度x=[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5];y=[93,89,64,35,30,25,18,10,0,0,0];z=[0.15,0.40,0.75,1.00,1.25,1.50,1.80,2.10,2.25,2.65,2.85];p=polyfit(x,y,z,4) x=linspace(0,115,30);y=polyval(p,x);plot(x,y);text(0,0,0,'origin');xlabel(' 小时'),ylabel(' 病虫剩余数量比例%'),zlabel(' 臭氧喷嘴出口处检测到的臭氧浓度'), grid;title(' 臭氧浓度与真菌作用');。
Matlab实现别踩白块小游戏的示例代码

Matlab实现别踩⽩块⼩游戏的⽰例代码⽬录游戏效果游戏说明完整代码pianoKeys.m(主函数)getMusic.m(⽤于获取⾳乐数据)游戏效果游戏说明‘A’,‘S’,‘D’,F’按键代表四条通路(点击S开始),按错按钮或⿊块接触底限均为失败。
完整代码分两个m⽂件,应放在同⼀⽂件夹pianoKeys.m(主函数)function pianoKeys%======================%========[v1,notes,fs]=getMusic;%读取⾳乐%======================%========fig=uifigure;fig.Position=[10 50 4*90 4*150];fig.NumberTitle='off';fig.MenuBar='none';fig.Resize='off';='pianoKeys';ax=uiaxes(fig);ax.Position=[-22 -15 4*90+36 4*150+40];ax.XLim=[0 4*90];ax.YLim=[0 4*150];ax.XColor=[0 0 0];ax.YColor=[0 0 0];ax.Box='on';ax.XTick=0:90:360;ax.YTick=[0 600];ax.XGrid='on';ax.GridColor=[0 0 0];ax.GridAlpha=1;ax.Toolbar.Visible='off';%==========================================================================blockList(1)=drawBlock(changeData(1),0,{'开始';'游戏'},v1{1});noDeleteList=1:4;newBlockY=600;newBlockNum=5;startFlag=0;gameOver=0;for i=2:4x=changeData(i);blockList(i)=drawBlock(x,(i-1)*150,'',v1{i});end%==========================================================================set(fig,'KeyPressFcn',@keyPressFcn)%==========================================================================fps=10;PKtimer=timer('ExecutionMode', 'fixedRate', 'Period',1/fps, 'TimerFcn', @pianoGame);start(PKtimer)%========================================================================== function pianoGame(~,~)if startFlagif newBlockY<=600&&newBlockNum<=length(v1)tempX=changeData(newBlockNum);blockList(newBlockNum)=drawBlock(tempX,newBlockY,'',v1{newBlockNum});noDeleteList=[noDeleteList,newBlockNum];newBlockNum=newBlockNum+1;newBlockY=newBlockY+150;endfor ii=noDeleteListblockList(ii).Position(2)=blockList(ii).Position(2)-150/8;endnewBlockY=newBlockY-150/8;if (~isempty(noDeleteList))&&blockList(noDeleteList(1)).Position(2)<-10gameOverFcn(1);gameOver=1;%tempStr=blockList(noDeleteList(1)).UserData;%sound(notes.(tempStr),fs)%delete(blockList(noDeleteList(1)))%noDeleteList(1)=[];endendendfunction gameOverFcn(coe)sound([notes.do0f,notes.do1f,notes.do2f,notes.do2f],fs)switch coecase 1blockList(noDeleteList(1)).BackgroundColor=[0.6 0 0];blockList(noDeleteList(1)).Text={'游戏';'失败'};startFlag=0;otherwiseobject=uilabel(fig);object.Text={'游戏';'失败'};object.Position=[coe,0+3-18.75,90,150];object.FontSize=26;object.FontWeight='bold';object.FontColor=[1 1 1];object.BackgroundColor=[0.6 0 0];object.HorizontalAlignment='center';endendfunction keyPressFcn(~,event)switch event.Keycase 'a',xPos=0+3;case 's',xPos=90+3;case 'd',xPos=180+3;case 'f',xPos=270+3;otherwise,xPos=-1;endif (~isempty(noDeleteList))&&blockList(noDeleteList(1)).Position(1)==xPos&&gameOver==0tempStr=blockList(noDeleteList(1)).UserData;sound(notes.(tempStr),fs)delete(blockList(noDeleteList(1)))if noDeleteList(1)==1startFlag=1;endnoDeleteList(1)=[];elseif blockList(noDeleteList(1)).Position(1)~=xPos&&xPos~=-1&&gameOver==0&&startFlag==1startFlag=0;gameOverFcn(xPos);gameOver=1;endend%========================================================================== function x=changeData(sort)note=v1{sort};switch note(1)case 'd',x=0;case 'r',x=0;case 'm',x=90;case 'f',x=90;case 's',x=180;case 'l',x=180;case 't',x=270;case 'b',x=270;endendfunction object=drawBlock(x,y,string,note)object=uilabel(fig);object.Text=string;object.Position=[x+3,y+3,90,150];object.FontSize=26;object.FontWeight='bold';object.FontColor=[1 1 1];object.BackgroundColor=[0 0 0];object.HorizontalAlignment='center';erData=note;endendgetMusic.m(⽤于获取⾳乐数据) function [v1,notes,fs]=getMusic% Most shining national wind//最炫民族风 on Matlab % The Modification is from "canon", not by mefs = 44100; % sample ratedt = 1/fs;T16 = 0.125;t16 = 0:dt:T16;[~,k] = size(t16);t4 = linspace(0,4*T16,4*k);t8 = linspace(0,2*T16,2*k);[~,i] = size(t4);[~,j] = size(t8);% Modification functionsmod4=(t4.^4).*exp(-30*(t4.^0.5));mod4=mod4*(1/max(mod4));mod8=(t8.^4).*exp(-50*(t8.^0.5));mod8=mod8*(1/max(mod8));mod16=(t16.^4).*exp(-90*(t16.^0.5));mod16=mod16*(1/max(mod16));f0 = 2*146.8; % reference frequencyScaleTable = [2/3 3/4 5/6 15/16 ...1 9/8 5/4 4/3 3/2 5/3 9/5 15/8 ...2 9/4 5/2 8/3 3 10/3 15/4 4 ...1/2 9/16 5/8];% 1/4 notesnotes.do0f = mod4.*cos(2*pi*ScaleTable(21)*f0*t4); notes.re0f = mod4.*cos(2*pi*ScaleTable(22)*f0*t4); notes.mi0f = mod4.*cos(2*pi*ScaleTable(23)*f0*t4); notes.fa0f = mod4.*cos(2*pi*ScaleTable(1)*f0*t4); notes.so0f = mod4.*cos(2*pi*ScaleTable(2)*f0*t4); 0f = mod4.*cos(2*pi*ScaleTable(3)*f0*t4); notes.ti0f = mod4.*cos(2*pi*ScaleTable(4)*f0*t4); notes.do1f = mod4.*cos(2*pi*ScaleTable(5)*f0*t4); notes.re1f = mod4.*cos(2*pi*ScaleTable(6)*f0*t4); notes.mi1f = mod4.*cos(2*pi*ScaleTable(7)*f0*t4); notes.fa1f = mod4.*cos(2*pi*ScaleTable(8)*f0*t4); notes.so1f = mod4.*cos(2*pi*ScaleTable(9)*f0*t4); 1f = mod4.*cos(2*pi*ScaleTable(10)*f0*t4); notes.tb1f = mod4.*cos(2*pi*ScaleTable(11)*f0*t4); notes.ti1f = mod4.*cos(2*pi*ScaleTable(12)*f0*t4); notes.do2f = mod4.*cos(2*pi*ScaleTable(13)*f0*t4);notes.re2f = mod4.*cos(2*pi*ScaleTable(14)*f0*t4); notes.mi2f = mod4.*cos(2*pi*ScaleTable(15)*f0*t4); notes.fa2f = mod4.*cos(2*pi*ScaleTable(16)*f0*t4); notes.so2f = mod4.*cos(2*pi*ScaleTable(17)*f0*t4); 2f = mod4.*cos(2*pi*ScaleTable(18)*f0*t4); notes.ti2f = mod4.*cos(2*pi*ScaleTable(19)*f0*t4); notes.do3f = mod4.*cos(2*pi*ScaleTable(20)*f0*t4); notes.blkf = zeros(1,i);% 1/8 notesnotes.do0e = mod8.*cos(2*pi*ScaleTable(21)*f0*t8); notes.re0e = mod8.*cos(2*pi*ScaleTable(22)*f0*t8); notes.mi0e = mod8.*cos(2*pi*ScaleTable(23)*f0*t8); notes.fa0e = mod8.*cos(2*pi*ScaleTable(1)*f0*t8); notes.so0e = mod8.*cos(2*pi*ScaleTable(2)*f0*t8); 0e = mod8.*cos(2*pi*ScaleTable(3)*f0*t8); notes.ti0e = mod8.*cos(2*pi*ScaleTable(4)*f0*t8); notes.do1e = mod8.*cos(2*pi*ScaleTable(5)*f0*t8); notes.re1e = mod8.*cos(2*pi*ScaleTable(6)*f0*t8); notes.mi1e = mod8.*cos(2*pi*ScaleTable(7)*f0*t8); notes.fa1e = mod8.*cos(2*pi*ScaleTable(8)*f0*t8); notes.so1e = mod8.*cos(2*pi*ScaleTable(9)*f0*t8); 1e = mod8.*cos(2*pi*ScaleTable(10)*f0*t8); notes.tb1e = mod8.*cos(2*pi*ScaleTable(11)*f0*t8); notes.ti1e = mod8.*cos(2*pi*ScaleTable(12)*f0*t8); notes.do2e = mod8.*cos(2*pi*ScaleTable(13)*f0*t8); notes.re2e = mod8.*cos(2*pi*ScaleTable(14)*f0*t8); notes.mi2e = mod8.*cos(2*pi*ScaleTable(15)*f0*t8); notes.fa2e = mod8.*cos(2*pi*ScaleTable(16)*f0*t8); notes.so2e = mod8.*cos(2*pi*ScaleTable(17)*f0*t8); 2e = mod8.*cos(2*pi*ScaleTable(18)*f0*t8); notes.ti2e = mod8.*cos(2*pi*ScaleTable(19)*f0*t8); notes.do3e = mod8.*cos(2*pi*ScaleTable(20)*f0*t8); notes.blke = zeros(1,j);% 1/16 notesnotes.do0s = mod16.*cos(2*pi*ScaleTable(21)*f0*t16); notes.re0s = mod16.*cos(2*pi*ScaleTable(22)*f0*t16); notes.mi0s = mod16.*cos(2*pi*ScaleTable(23)*f0*t16); notes.fa0s = mod16.*cos(2*pi*ScaleTable(1)*f0*t16); notes.so0s = mod16.*cos(2*pi*ScaleTable(2)*f0*t16); 0s = mod16.*cos(2*pi*ScaleTable(3)*f0*t16); notes.ti0s = mod16.*cos(2*pi*ScaleTable(4)*f0*t16); notes.do1s = mod16.*cos(2*pi*ScaleTable(5)*f0*t16); notes.re1s = mod16.*cos(2*pi*ScaleTable(6)*f0*t16); notes.mi1s = mod16.*cos(2*pi*ScaleTable(7)*f0*t16); notes.fa1s = mod16.*cos(2*pi*ScaleTable(8)*f0*t16); notes.so1s = mod16.*cos(2*pi*ScaleTable(9)*f0*t16); 1s = mod16.*cos(2*pi*ScaleTable(10)*f0*t16); notes.tb1s = mod16.*cos(2*pi*ScaleTable(11)*f0*t16); notes.ti1s = mod16.*cos(2*pi*ScaleTable(12)*f0*t16); notes.do2s = mod16.*cos(2*pi*ScaleTable(13)*f0*t16); notes.re2s = mod16.*cos(2*pi*ScaleTable(14)*f0*t16); notes.mi2s = mod16.*cos(2*pi*ScaleTable(15)*f0*t16); notes.fa2s = mod16.*cos(2*pi*ScaleTable(16)*f0*t16); notes.so2s = mod16.*cos(2*pi*ScaleTable(17)*f0*t16); 2s = mod16.*cos(2*pi*ScaleTable(18)*f0*t16); notes.ti2s = mod16.*cos(2*pi*ScaleTable(19)*f0*t16); notes.do3s = mod16.*cos(2*pi*ScaleTable(20)*f0*t16); notes.blks = zeros(1,k);% Melody by Schau_malpart0={'mi1f' 'la0e' 'la0e' 'do1f' 'mi1f' ...'re1e' 're1s' 'mi1s' 're1e' 'do1e' 're1e' 'do1e' 'la0f' ...'mi1f' 'la0e' 'la0e' 'do1f' 'mi1f' ...'so1e' 're1s' 'mi1s' 're1e' 'do1e' 're1e' 'do1e' 'ti0e' 'so0e' ... 'mi1f' 'la0e' 'la0e' 'do1f' 'mi1f' ...'re1e' 're1s' 'mi1s' 're1e' 'do1e' 're1e' 'do1e' 'la0e' 'so0e' ... 'mi1f' 'la0e' 'la0e' 'do1f' 'mi1f' ...'so1e' 'mi1e' 'blkf' 'blkf' 'blkf' };part1={'la0f' 'la0e' 'so0e' 'la0f' 'la0e' 'do1e' ...'do1f' 're1e' 'do1e' 'la0f' 'la0f' ...'do1f' 'do1e' 'so0e' 'do1e' 're1e' 'mi1e' 'so1e' ...'so1e' 'mi1e' 're1f' 'mi1f' 'mi1f' ...'la1e' 'la1e' 'la1e' 'so1e' 'mi1e' 'mi1f' 'do1e' ...'la0e' 'la0e' 'la0e' 'mi1e' 're1s' 'mi1s' 're1e' 're1f' ...'mi1e' 'mi1e' 'so1e' 'mi1e' 're1e' 'mi1e' 're1e' 'do1e' ...'la0f' 'so0f' 'la0f' 'la0f' ...};part2={'mi1e' 'mi1e' 'so1e' 'mi1e' 'mi1e' 'so1e' 'so1e' 'la1e' ...'do2e' 'la1e' 'so1f' 'la1s' 'do2s' 'la1e' 'la1f' ...'la0f' 'la0e' 'so0e' 'la0f' 'do1f' ...'re1e' 'mi1s' 're1s' 'do1e' 're1e' 'mi1f' 'mi1f' ...'la0e' 'la1e' 'la1e' 'so1e' 're1e' 'mi1s' 're1s' 'do1e' 're1e' ...'mi1f' 'mi1f' 'blke' 'blke' 'blkf' ...'do1e' 'la0e' 'la0e' 'do1e' 're1f' 'so0e' 'so0e' ...'mi1e' 'so1e' 'mi1e' 're1e' 'do1f' 'do1f' ...'la0e' 'do1e' 're1e' 'mi1e' 're1e' 'do1e' 'so0e' 'mi0e' ...'la0f' 'la0f' 'blke' 'blke' 'blkf' ...};part3={'la0f' 'la0e' 'so0e' 'la0f' 'do1f' ...'re1e' 'mi1s' 're1s' 'do1e' 're1e' 'mi1f' 'mi1f' ...'la0e' 'la1e' 'la1e' 'so1e' 're1e' 'mi1s' 're1s' 'do1e' 're1e' ...'mi1f' 'mi1f' 'blke' 'blke' 'blkf' ...'do1e' 'la0e' 'la0e' 'do1e' 're1f' 'so0e' 'so0e' ...'mi1e' 'so1e' 'mi1e' 're1e' 'do1f' 'do1e' 'do1e' ...'la0e' 'do1e' 're1e' 'mi1e' 'so1e' 'mi1e' 'mi1e' 'so1e' ...'la1f' 'la1f' 'la1f' 'la1f' ...};part4={'la1e' 'la1s' 'la1s' 'la1e' 'la1e' 'la1e' 'la1s' 'so1s' 'mi1e' 're1e' ...'re1e' 're1s' 're1s' 'mi1e' 'mi1s' 'so1s' 'mi1e' 'mi1s' 're1s' 'do1e' 'do1s' 'la0s' ...'la0f' 'la0e' 'so0e' 'la0f' 'la0e' 'do1e' ...'re1e' 'mi1s' 're1s' 'do1e' 're1e' 'mi1f' 'mi1f' ...'la1e' 'so1e' 'mi1e' 're1e' 'so1e' 'mi1e' 're1e' 'do1e' ...'do1f' 'do1f' 'la0s' 'do1s' 're1s' 'mi1s' 're1s' 'do1s' 'la0s' 'do1s'};part5={'do2e' 'do2s' 'do2s' 'la1e' 'la1s' 'la1s' 'so1e' 'so1s' 'so1s' 'mi1e' 'mi1s' 'mi1s' ...'re1e' 'mi1s' 're1s' 'do1e' 'la0s' 'so0s' 'la0s' 'so0s' 'do1s' 're1s' 'mi1s' 'so1s' 'la1s' 're2s' ...'do2f' 'do2f' 'blks' 'blks' 'blks' 'blks' 'do1e' 're1e' ...'mi1f' 'mi1f' 'mi1f' 'so1e' 'mi1e' ...'la1f' 'la1f' 'la1e' 'do1e' 'so1e' 'mi1e' ...'re1f' 're1e' 're1s' 're1s' 're1e' 're1e' 'do1e' 're1e' ...'mi1f' 'mi1e' 'mi1s' 'mi1s' 'mi1e' 're1s' 'do1s' 'ti0e' 'do1s' 're1s' ...'mi1f' 'mi1f' 'mi1f' 'so1e' 'mi1e' ...'do2f' 'la1f' 'la1f' 'la1e' 'do1e' ...'re1f' 'so1f' 'so1f' 'la1f' ...'ti1f' 'ti1f' 'ti1f' 'ti1f' ...};part6={'blkf' 'blkf' 'mi1e' 'so1e' 'mi1e' 'so1e' ...'mi1f' 'la0e' 'la0s' 'la0s' 'do1f' 'la0e' 'mi1s' 'la0s' ...'do1e' 'do1s' 'do1s' 're1e' 'do1s' 're1s' 'mi1f' 'mi1f' ...'mi1f' 'la0e' 'la0s' 'la0s' 'so1f' 're1e' 're1s' 're1s' ...'mi1f' 'mi1f' 'mi1s' 're1s' 'do1s' 'la0s' 'mi0s' 're0s' 'mi0s' 'so0s' ...'do1f' 'la0e' 'la0s' 'la0s' 're1f' 'so0e' 'so0s' 'so0s' ...'mi0f' 'so0e' 'so0s' 'so0s' 'do1f' 'do1f' ...'la0f' 'do1e' 'do1s' 'la0s' 'mi1e' 'mi1s' 'mi1s' 're1e' 're1s' 'mi1s' ...};% Combination, v1 is complete version, v2 is simple version.v1 = [part0 part1 part1 part2 part3 part4 part0 part1 part1 part2 part3 part5 part3 part6 part3];%v2 = [part0 part1 part1 part2 part3 part5 part3 part6 part3];end到此这篇关于Matlab实现别踩⽩块⼩游戏的⽰例代码的⽂章就介绍到这了,更多相关Matlab别踩⽩块游戏内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!。
matlab小程序

Fibonacci数列f(1)=0;f(2)=1;for i=1:100f(i+2)=f(i)+f(i+1);i=i+1;if f(i)>4000&f(i)<5000disp('大于4000的Fibonacci数列的最小项为:');disp(f(i));disp('5000之内的项数为:')disp(i);endend猜数游戏x=floor(100*rand(1));for i=0:6y=input('请输入猜测数');if y>xdisp('High')else if y<xdisp('Low')else if y==xdisp('You won')endendendend成绩处理A=[78,89,64,73,68;83,77,80,78,70;82,91,78,82,68][x,y] =max(A');%每行的最大之以及列号disp('高数,外语,MATLAB三门课的最高分数分别为:');disp(x);disp('对应的学生序号为:');disp(y);a=sum(A) %列求和[x1,y1] =max(a');%每行的最大之以及列号disp('总分最高分为:');disp(x1);disp('对应的学生序号为:');disp(y1);A1=max(A)%将每一列元素最大值A1输出maxA=max(A1) %找出最大元素为矩阵里最大元素k=find(A==maxA)%得到最大元素线性坐标[row col]=ind2sub(size(A),k) %得到最大元素矩阵下标row-行col-列A=magic(4)% 每列的最大之以及行号[Y_col,Ind_col] =max(A)%每行的最大之以及列号[Y_row,Ind_row] =max(A')%最大值Ymax=max(max(A))A=magic(4)% 每列的最大之以及行号[X_col,Ind_row] =max(A)%每行的最大之以及列号[Y_row,Ind_row] =max(A')%最大值Ymax=max(max(A))求最大最小值for i=1:5a(i)=input('请输入您要显示数字的序号:');disp('您要显示的数字为:');disp(a(i));endmaxa=max(a);mina=min(a);maxamina。
matlab小程序

输入5个分数,小于60分的显示‘No pass!’,大于或等于60分显示‘Pass!’。
>> for i=1:5S=input('Enter the score')if S<60disp('No passed!')elsedisp('Passed!')endendEnter the score43S =43No passed!Enter the score55S =55No passed!Enter the score86S =86Passed!Enter the score84S =84Passed!Enter the score57S =57No passed! >> 99ans =99输入分数,大于90的显示‘Good!’,其余的显示‘Ok!’。
>> S=input('Enter the score')if S>90disp('Good!')elsedisp('Ok!')endEnter the score91S =91Good!>>求定积分sin24t txdt。
>> x=sym('x');t=sym('t');>> f=8*t*x;>> b=sin(t);>> Ix=int(f,x,2,b)Ix =- 4*t*cos(t)^2 - 12*t求微分方程dx/dt=6x-y,dy/dt=2x-y的通解。
>> [x,y]=dsolve('Dx=6*x-y','Dy=2*x-y','t')x =(7*C1*exp((5*t)/2 + (41^(1/2)*t)/2))/4 + (7*C2*exp((5*t)/2 - (41^(1/2)*t)/2))/4 + (41^(1/2)*C1*exp((5*t)/2 + (41^(1/2)*t)/2))/4 - (41^(1/2)*C2*exp((5*t)/2 - (41^(1/2)*t)/2))/4y =C1*exp((5*t)/2 + (41^(1/2)*t)/2) + C2*exp((5*t)/2 - (41^(1/2)*t)/2)绘制曲线y1=sinx,y2=x e。
matlab教程ppt(完整版)

矩阵减法:两个相同大小 的矩阵可以进行减法运算 ,例如D=A-B。
矩阵的分解与特征值
详细描述
矩阵分解:将一个复杂的矩阵分 解为几个简单的、易于处理的矩 阵,例如LU分解、QR分解等。
特征值:矩阵的特征值是该矩阵 的一个重要的数值属性,可以用 于分析矩阵的性质和特征。
矩阵运算
介绍矩阵的创建、索引、算术 运算和逻辑运算等操作。
控制流
介绍if语句、for循环和while 循环等控制流结构的使用方法 。
02
MATLAB编程
变量与数据类型
01
02
03
变量命名规则
MATLAB中的变量名以字 母开头,可以包含字母、 数字和下划线,但不能包 含空格。
数据类型
MATLAB支持多种数据类 型,如数值型、字符型、 逻辑型和单元数组等。
matlab教程PPT(完整版)
汇报人:可编辑 2023-12-26
目 录
• MATLAB基础 • MATLAB编程 • MATLAB矩阵运算 • MATLAB图像处理 • MATLAB数值分析 • MATLAB应用实例
01
MATLAB基础
MATLAB简介
MATLAB定义
MATLAB应用领域
MATLAB是一种用于算法开发、数据 可视化、数据分析和数值计算的编程 语言和环境。
函数编写
01
02
03
04
函数定义
使用`function`关键字定义函 数,指定输入输出参数。
函数体
在函数定义中编写实现特定功 能的代码。
函数调用
通过函数名和输入参数调用自 定义函数。
matlab经典的小程序

1.分段函数for x=-pi*6:pi/10:6*piy=sin(x);if y<0y=0;endfprintf('x=%f,y=%f\n',x,y);end2.计算距离x1=input('enter the x1:' );y1=input(’enter the y1:' );x2=input(’enter the x2:' );y2=input('enter the y2:’ );d=sqrt((x1—x2)。
^2+(y1—y2)。
^2);fprintf(’the distance of the two points is :%f’,d);v0=input('Enter the 初速度v0:');h0=input(’Enter the 离地高度h0:’);t=0:0。
01:53.重力加速度h=—0。
5*9。
81*t.^2+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)’);4.坐标转换function [x, y] = polar2rect(r, theta)x = r * cos(theta * pi/180);y = r * sin(theta * pi/180);5。
坐标转换,带参数检验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: angle is meaningless!'; warning(msg);end% Now calculate the magnitudemag = sqrt(x 。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
[教学]MATLAB小程序MATLAB小程序1-1.1 描绘出“点”%密度和穗花被害率x=[0,3,10,20,30,40];y1=[0,0.273,2.260,2.550,2.920,3.950];subplot(2,2,1);plot(x,y1);title(' 密度和穗花被害率');xIabelC 头肝八2');ylabel(' 穗花被害率%');%密度和结实率x=[0,3,10,20,30,40];y2=[94.4,93.2,92.1,91.5,89.9,87.9];subplot(2,2,2);plot(x,y2);title(' 密度和结实率');xIabelC 头/m^2');ylabel(' 结实率%');%密度和千粒重x=[0,3,10,20,30,40];y3=[21.37,20.60,20.60,20.50,20.60,20.13];subplot(2,2,3);xIabelC 头/mV);ylabel(' 千重粒g');%密度和减产率x=[0,3,10,20,30,40];y4=[0,2.4,12.9,16.3,20.1,26.8];subplot(2,2,4);plot(x,y4);title(' 密度和减产率');xlabel(' 头/mV);ylabel(' 减产率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06]; subplot(2,2,1);plot(x,y1);title(' 密度和减产率');xIabelC 头/m^2');ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40]; subplot(2,2,2);xIabelC 头肝八2');ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,2 5.16];subplot(2,2,3);plot(x,y3);title(' 密度和减产率');xIabelC 头/m^2');ylabel(' 空壳率%');%进行曲线拟合%密度和穗花被害率x=[0,3,10,20,30,40];y1=[0,0.273,2.260,2.550,2.920,3.950];subplot(2,2,1);p=polyfit(x,y1,4) x=linspace(0,40,40);y=polyval(p,x);plot(x,y);title(' 密度和穗花被害率');xIabelC 头肝八2');ylabel(' 结实率%');%密度和结实率x=[0,3,10,20,30,40];y2=[94.4,93.2,92.1,91.5,89.9,87.9]; subplot(2,2,2);p=polyfit(x,y2,4) x=linspace(0,40,40);y2=polyval(p,x);plot(x,y2);title(' 密度和结实率');xIabelC 头/mV);ylabel(' 结实率%');%密度和千粒重x=[0,3,10,20,30,40];y3=[21.37,20.60,20.60,20.50,20.60,20.13]; subplot(2,2,3);p=polyfit(x,y3,4)x=linspace(0,30,30);y3=polyval(p,x);plot(x,y3);title(' 密度和千粒重');xIabelC 头肝八2');ylabel(' 千重粒g');%密度和减产率x=[0,3,10,20,30,40];y4=[0,2.4,12.9,16.3,20.1,26.8];subplot(2,2,4);p=polyfit(x,y4,4) x=linspace(0,40,40);y4=polyval(p,x)plot(x,y4);title(' 密度和减产率');xlabel(' 头/mV);ylabel(' 减产率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50]; y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06]; subplot(2,2,1);plot(x,y1);title(' 产量损失率');xIabelC 头/mV);ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40]; subplot(2,2,2);plot(x,y2);title(' 卷叶率');xIabelC 头肝八2');ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,25.16]; subplot(2,2,3);plot(x,y3);title(' 空壳率');xlabel(' 头/mV);ylabel(' 空壳率%')%1-1.2 表2 稻纵卷叶螟与水稻作用的数据%产量损失率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y1=[0.73,1.11,2.2,3.37,5.05,6.78,7.16,9.39,14.11,20.06];subplot(2,2,1);title(' 产量损失率');xIabelC 头肝八2');ylabel(' 减产率%');%卷叶率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112.50];y2=[0.76,1.11,2.22,3.54,4.72,6.73,7.63,14.82,14.93,20.40];p=polyfit(x,y1,4)x=linspace(0,115,30);y=polyval(p,x);plot(x,y);subplot(2,2,2);p=polyfit(x,y2,4) x=linspace(0,115,30);y=polyval(p,x);plot(x,y) title(' 卷叶率');xIabelC 头/mV);ylabel(' 卷叶率%');%空壳率:x=[3.75,7.50,11.25,15.00,18.75,30.00,37.50,56.25,75.00,112. 50];y3=[14.22,14.43,15.34,15.59,16.87,17.10,17.21,20.59,23.19,2 5.16];subplot(2,2,3);p=polyfit(x,y1,4)x=linspace(0,115,30);y=polyval(p,x);plot(x,y);title(' 空壳率');xIabelC 头肝八2');ylabel(' 空壳率%')题 1.3 代码%x为臭氧持续作用时间,y为病虫害经臭氧处理时的剩余数量比例,%z%臭氧喷嘴出口处检测到的臭氧浓度x=[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5];y=[93,89,64,35,30,25,18,10,0,0,0];z=[0.15,0.40,0.75,1.00,1.25,1.50,1.80,2.10,2.25,2.65,2.85]; plot3(x,y,z,'m');text(0,0,0,'origin');xlabel(' 小时'),ylabel(' 病虫剩余数量比例%'),zlabel(' 臭氧喷嘴出口处检测到的臭氧浓度'),grid;title(' 臭氧浓度与真菌作用');进行曲线拟合%x为臭氧持续作用时间,y为病虫害经臭氧处理时的剩余数量比例,%z%臭氧喷嘴出口处检测到的臭氧浓度x=[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5];y=[93,89,64,35,30,25,18,10,0,0,0];z=[0.15,0.40,0.75,1.00,1.25,1.50,1.80,2.10,2.25,2.65,2.85];p=polyfit(x,y,z,4) x=linspace(0,115,30);y=polyval(p,x);plot(x,y);text(0,0,0,'origin');xlabel(' 小时'),ylabel(' 病虫剩余数量比例%'),zlabel(' 臭氧喷嘴出口处检测到的臭氧浓度'), grid;title(' 臭氧浓度与真菌作用');。