matlab学习资料
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
>> p=[2 -1 0 3];
>> x=2;
>>polyval(p,x)
ans =
15
>> x=[-1, 2;-2 1];
>>polyval(p,x)
ans =
0 15
-17 4
>> p1=[1,2,4,0,5];
>> p2=[1,2];
>> p3=[1,2,3);
??? p3=[1,2,3);
|
Error: Unbalanced or unexpectedparenthesisor bracket.
>> p3=[1,2,3];
>> p4=conv(p2,p3);
>> p=p1+[0 p4];
>> x=roots(p)
x =
-1.3840 + 1.8317i
-1.3840 - 1.8317i
-0.1160 + 1.4400i
-0.1160 - 1.4400i
>> x=roots(p);
>> p1=[1,2,4,0,5];
p2=[1,2];
p3=[1,2,3];
p4=conv(p2,p3);
p=p1+[0 p4]
x=roots(p)
p =
1 3 8 7 11
x =
-1.3840 + 1.8317i
-1.3840 - 1.8317i
-0.1160 + 1.4400i
-0.1160 - 1.4400i
>> A=[-1,1.2,-1.4;0.75,2,3.5;0,5,2.5]; >>polyval(p,A)
ans =
1.0e+003 *
0.0100 0.0382 0.0125
0.0223 0.0970 0.4122
0.0110 1.2460 0.1644
>> A=[-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+11
px =
1.0e+003 *
0.0076 -0.1172 -0.0665
0.1437 1.3900 1.1754
0.1934 1.7474 1.5198
>> x=['Matlab±à³Ì';'ʵÑé»·½Ú ']
x =
Matlab±à³Ì
ʵÑé»·½Ú
>> y=str2mat('Matlab±à³Ì','ʵÑé»·½Ú') y =
Matlab±à³Ì
ʵÑé»·½Ú
>> y=[x(1,:),x(2,:)]
y =
Matlab±à³ÌʵÑé»·½Ú
3
>>syms a bcdx
>> f=a*x^3+b*x^2+c*x+d
f =
a*x^3 + b*x^2 + c*x + d
>> f=sym('a*x^3+b*x^2+c*x+d')
f =
a*x^3 + b*x^2 + c*x + d
>> A=sym('[a*cos(x)+b*sin(y)10+20;a*x^2+cz^2 sqrt(t^2+1)]')
??? Error using==>sym.sym>expression2refat2408
Error: Unexpected 'integer' [line 1, col 27]
Error in==>sym.sym>char2refat2378
s = expression2ref(x);
Error in==>sym.sym>tomupadat2147
S = char2ref(x);
Error in==>sym.sym>sym.symat102
S.s = tomupad(x,'');
>> A=sym('[a*cos(x)+b*sin(y) 10+20;a*x^2+b*y^2+cz^2 sqrt(t^2+1)]') A =
[ a*cos(x) + b*sin(y), 30]
[ cz^2 + a*x^2 + b*y^2, (t^2 + 1)^(1/2)]
>>syms x%sym('x')
>> f=1-(sin(x))^2;
>> g=2*x+1;
>> x=1;
>>subs(f)
ans =
0.2919
>>syms x
>> f=1=(sin(x))^2;
??? f=1=(sin(x))^2;
|
Error: The expression totheleftoftheequalssign
is notavalidtargetforanassignment.
>> f=1-(sin(x))^2;
>> g=2*x+1;
>>compose(f,g)
ans =
1 - sin(2*x + 1)^2
>>finverse(f)
Warning: finverse(1 - sin(x)^2) is notunique.
ans =
asin((1 - x)^(1/2))
>>finverce(g)
??? Undefined functionormethod'finverce'forinput arguments oftype'sym'.
>>finverse(g)
ans =
x/2 - 1/2
>>syms x yabcd
>> f=a*x^3+b*x^2+c*y+d;
>>diff(f,'x')
ans =
3*a*x^2 + 2*b*x
>>diff(f,'c')
ans =
y
>>diff(f,'y')
ans =
c
>>diff(f,'d')
ans =
1
>> M=limit(f,y,1)
M =
a*x^3 + b*x^2 + c + d
>>diff(f,'x',3)
ans =
6*a