您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > matlab学习资料
p=[2-103];x=2;polyval(p,x)ans=15x=[-1,2;-21];polyval(p,x)ans=015-174p1=[1,2,4,0,5];p2=[1,2];p3=[1,2,3);???p3=[1,2,3);|Error:Unbalancedorunexpectedparenthesisorbracket.p3=[1,2,3];p4=conv(p2,p3);p=p1+[0p4];x=roots(p)x=-1.3840+1.8317i-1.3840-1.8317i-0.1160+1.4400i-0.1160-1.4400ix=roots(p);p1=[1,2,4,0,5];p2=[1,2];p3=[1,2,3];p4=conv(p2,p3);p=p1+[0p4]x=roots(p)p=138711x=-1.3840+1.8317i-1.3840-1.8317i-0.1160+1.4400i-0.1160-1.4400iA=[-1,1.2,-1.4;0.75,2,3.5;0,5,2.5];polyval(p,A)ans=1.0e+003*0.01000.03820.01250.02230.09700.41220.01101.24600.1644A=[-1,1.2,-1.4;0.75,2,3.5;0,5,2.5];x=A;px=x^4+3*x^3+8*x^2+7*x+11px=1.0e+003*0.0076-0.1172-0.06650.14371.39001.17540.19341.74741.5198x=['Matlab±à³Ì';'ʵÑé»·½Ú']x=Matlab±à³ÌʵÑé»·½Úy=str2mat('Matlab±à³Ì','ʵÑé»·½Ú')y=Matlab±à³ÌʵÑé»·½Úy=[x(1,:),x(2,:)]y=Matlab±à³ÌʵÑé»·½Ú3symsabcdxf=a*x^3+b*x^2+c*x+df=a*x^3+b*x^2+c*x+df=sym('a*x^3+b*x^2+c*x+d')f=a*x^3+b*x^2+c*x+dA=sym('[a*cos(x)+b*sin(y)10+20;a*x^2+cz^2sqrt(t^2+1)]')???Errorusing==sym.symexpression2refat2408Error:Unexpected'integer'[line1,col27]Errorin==sym.symchar2refat2378s=expression2ref(x);Errorin==sym.symtomupadat2147S=char2ref(x);Errorin==sym.symsym.symat102S.s=tomupad(x,'');A=sym('[a*cos(x)+b*sin(y)10+20;a*x^2+b*y^2+cz^2sqrt(t^2+1)]')A=[a*cos(x)+b*sin(y),30][cz^2+a*x^2+b*y^2,(t^2+1)^(1/2)]symsx%sym('x')f=1-(sin(x))^2;g=2*x+1;x=1;subs(f)ans=0.2919symsxf=1=(sin(x))^2;???f=1=(sin(x))^2;|Error:Theexpressiontotheleftoftheequalssignisnotavalidtargetforanassignment.f=1-(sin(x))^2;g=2*x+1;compose(f,g)ans=1-sin(2*x+1)^2finverse(f)Warning:finverse(1-sin(x)^2)isnotunique.ans=asin((1-x)^(1/2))finverce(g)???Undefinedfunctionormethod'finverce'forinputargumentsoftype'sym'.finverse(g)ans=x/2-1/2symsxyabcdf=a*x^3+b*x^2+c*y+d;diff(f,'x')ans=3*a*x^2+2*b*xdiff(f,'c')ans=ydiff(f,'y')ans=cdiff(f,'d')ans=1M=limit(f,y,1)M=a*x^3+b*x^2+c+ddiff(f,'x',3)ans=6*adiff(f,'x',2)ans=2*b+6*a*xfindsym(f)ans=a,b,c,d,x,ysymsnf1=(1-1/2*2^(-n))/(1-1/2)f1=2-1/2^nlimit(f1,n,inf)ans=2symsnf=1/2^nlimit(symsum(f,0,n),n,inf)f=1/2^nans=2symxy???Errorusing==sym.symassumptionsat2180Secondargumentynotrecognized.Errorin==sym.symtomupadat2148assumptions(S,x,a);Errorin==sym.symsym.symat114S.s=tomupad(x,a);symsxyf1=sqrt(x)/(1+x)^2;int(f1,x,1,inf)ans=pi/4+1/2f2=x*exp(-x*y)int(int(f2,x),y)f2=x/exp(x*y)ans=1/(y*exp(x*y))y=dsolve('D2y+2*Dy+2*y=0','y(0)=1','Dy(0)=0','x')y=cos(x)/exp(x)+sin(x)/exp(x)z=dsolve('Dx=2*x+3*y','Dy=x-2*y','x(0)=1','y(0)=2','t')z=x:[1x1sym]y:[1x1sym]Z.X???Undefinedfunctionorvariable'Z'.z.xans=(exp(7^(1/2)*t)*(2*7^(1/2)-3))/2-(2*7^(1/2)+3)/(2*exp(7^(1/2)*t))+(7^(1/2)*exp(7^(1/2)*t)*(2*7^(1/2)-3))/7+(7^(1/2)*(2*7^(1/2)+3))/(7*exp(7^(1/2)*t))z.yans=(7^(1/2)*exp(7^(1/2)*t)*(2*7^(1/2)-3))/14+(7^(1/2)*(2*7^(1/2)+3))/(14*exp(7^(1/2)*t))y=dsolve('Dy+y*tan(x)=cos(x)','x')y=C7*cos(x)+x*cos(x)f1='x+2*y-z-7';f2='x+z-3';f3='x^2+3*y^2-28';[x,y,z]=solve(f1,f2,f3,'x','y','z')x=15/4-37^(1/2)/437^(1/2)/4+15/4y=37^(1/2)/4+5/45/4-37^(1/2)/4z=37^(1/2)/4-3/4-37^(1/2)/4-3/44clearx=input('ÇëÊäÈëxµÄÖµ:')ÇëÊäÈëxµÄÖµ:-5.0,-3.0,1.0,2.0,2.5,3.0,5.0???Error:UnexpectedMATLABoperator.ÇëÊäÈëxµÄÖµ:-5.0x=-5x=-3.0x=-3x=1.0x=1x=2.0x=2x=2.5x=2.5000x=3.0x=3x=5.0x=5if(x0&x~=-3)y=x.^2+x-6;elseif(x=0&x10&x~=2&x~=3)y=x.^2-5.*x+6;elsey=x.^2-x-6;endyy=6x=-5.0x=-5-5.0ans=-5clearx=input('ÇëÊäÈëxµÄÖµ:')if(x0&x~=-3)y=x.^2+x-6;elseif(x=0&x10&x~=2&x~=3)y=x.^2-5.*x+6;elsey=x.^2-x-6;endyÇëÊäÈëxµÄÖµ:-5.0ÇëÊäÈëxµÄÖµ:-5.0x=-5y=14???ÇëÊäÈëxµÄÖµ:-5.0|Error:TheinputcharacterisnotvalidinMATLABstatementsorexpressions.clearB=rand(5,6)n=input('ÊäÈënÖµ£º')trydisp(B(n,:))catchdisp(B(5,:))lasterrendB=Columns1through50.81470.09750.15760.14190.65570.90580.27850.97060.42180.03570.12700.54690.95720.91570.84910.91340.95750.48540.79220.93400.63240.96490.80030.95950.6787Column60.75770.74310.39220.65550.1712ÊäÈënÖµ£º6n=6Columns1through50.63240.96490.80030.95950.6787Column60.1712ans=AttemptedtoaccessB(6,:);indexoutofboundsbecausesize(B)=[5,6].clearB=rand(5,6)n=input('ÊäÈënÖµ£º')trydisp(B(n,:))catchdisp(B(5,:))lasterrendB=Columns1through50.70600.82350.43870.48980.27600.03180.69480.38160.44560.67970.27690.31710.76550.64630.65510.04620.95020.79520.70940.16260.09710.03440.18690.75470.1190Column60.49840.95970.34040.58530.2238ÊäÈënÖµ£º3n=3Columns1through50.27690.31710.76550.64630.6551Column60.34045clearn=input('ÇëÊäÈëÒ»¸öÊýÖµ£º');y=0;fori=1:ny=y+6/(n^2);enddisp(['Pi=',num2str(sqrt(y))])ÇëÊäÈëÒ»¸öÊýÖµ£º100Pi=0.24495ÇëÊäÈëÒ»¸öÊýÖµ£º1000???ÇëÊäÈëÒ»¸öÊýÖµ£º1000|Error:TheinputcharacterisnotvalidinMATLABstatementsorexpressions.clearn=input('ÇëÊäÈëÒ»¸öÊýÖµ£º');y=0;fori=1:ny=y+6/(n^2);enddisp(['Pi=',num2str(sqrt(y))])ÇëÊäÈëÒ»¸öÊýÖµ£º1000Pi=0.07746clearn=input('ÇëÊäÈëÒ»¸öÊýÖµ£º');y=0;fori=1:ny=y+6/(n^2);enddisp(['Pi=',num2str(sqrt(y))])ÇëÊäÈëÒ»¸öÊýÖµ£º10000Pi=0.024495clearn=input('ÇëÊäÈëÒ»¸öÊýÖµ£º');n=[10010001000]a=1:1:n;a=1./(a.^2);y=sum(a);disp(['Pi=',nu
本文标题:matlab学习资料
链接地址:https://www.777doc.com/doc-2887373 .html