TA的每日心情 | 开心 2019-11-29 15:38 |
|---|
签到天数: 4 天 [LV.2]偶尔看看I
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
0 a+ [1 |8 `9 i, q" l$ H
+ B0 C/ F- a+ J, {这是书上的一段代码,但是用18的matlab运行不了,想请教一下大神如何修改才能运行呢?感谢!$ c9 J; ^% {! p
syms a b x;
) f' x" Y6 I' d* y0 M+ pf1=a*sin(x)+b T& B4 }: |5 P4 Q n
f2=subs(f1,sin(x),'log(y)')% i$ W V c, I9 \, W2 d' @
class(f2)% r1 T7 ]5 ^* o5 Y2 O) ^0 E
f3=subs(f1,a,sym(3.11)); A- L) ~- e# A4 r
class(f3)
2 x; N& t+ |; t4 z3 o% w- L9 af4=subs(f1,x,[0,pi/2,pi])
+ T @* Q- X# I% T& g) a9 E3 rclass(f4)1 v9 B+ N% X7 e& @1 i8 D) N
format+ M n5 N W; F8 F6 I U9 K
format compact& V' Z1 Q7 I3 R" r
t=0:pi/10:2*pi;
& f" K* ?' E: s% G9 Nf5=subs(f1,{a,b,x},{2.3,t});
8 B& [$ K+ l. E/ l% J1 @class(f5)
( N+ m" M) s+ S* lplot(t,f5,'r:','LineWidth',5)+ O: m4 h- P1 ^
k=[0.6;0.8;1];
+ u1 X9 L, a: J: j2 Y( bf6=subs(subs(f1,{a,b},{k,2}),x,t);
1 n7 J8 S& G ]& Y# L9 ^class(f6)" R6 F- S; g3 U0 j6 r$ R
plot(t,f6)1 w _" `9 k' i% ?( y) R: V3 Y+ s
8 b4 \' i2 f; u: X( k2 K( Q2 k; ]8 |" `! S
提示错误信息; i1 y* {9 O; q8 g$ Z
错误使用 sym>convertChar (line 1448)+ ^/ I3 ~% n0 E. {1 O
Character vectors and strings in the first argument can only specify a variable or number. To evaluate character vectors and strings
4 H$ f* @4 f) _, u6 }. C8 Vrepresenting symbolic expressions, use 'str2sym'.
, z8 M8 E# W& ^
! c% l4 r) P6 Q3 ?" s8 k- `
# j6 C9 q' U' A出错 sym>tomupad (line 1214)) [- W! v; t* m9 o! T# C1 _
S = convertChar(x);
8 b0 T- h0 F$ m
. X8 w- U3 n6 @$ G: L2 ]4 Y
. F! [# d0 S1 E" U% \' i- @出错 sym (line 211)2 w, C1 ~; H3 e
S.s = tomupad(x);, x. x D0 a4 P$ \" ~: M6 G
, R2 y3 b9 k( W, n) X
% V' n( @6 h& _出错 sym/subs>normalize (line 211)
# O7 G/ h* |# A5 p. q) |# f Y = {sym(Y)};: I% I$ {+ ?+ }: L1 \5 `! D
+ h5 i. }6 ]8 f" N( w
( ~4 T. Y, V+ Z- _% E1 f! y$ s出错 sym/subs>mupadsubs (line 157)
7 }) V. v9 r+ X8 _ D/ O[X2,Y2,symX,symY] = normalize(X,Y); %#ok
. S' y; Y; P: U, R) B& E k' R% ^, c" J: ?! S, `
2 b/ J" i' A- h8 U8 V
出错 sym/subs (line 145)
$ J5 J% h9 _; a( i- V% x( ~
) F- H9 i' F0 y* i4 x# z+ b G = mupadsubs(F,X,Y); |
|