TA的每日心情 | 开心 2019-11-29 15:38 |
---|
签到天数: 4 天 [LV.2]偶尔看看I
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
. U/ z7 \5 s! f+ b8 ?0 Z( A
: R* p. J! O, h+ M这是书上的一段代码,但是用18的matlab运行不了,想请教一下大神如何修改才能运行呢?感谢!3 C# q% D* r! ~8 D5 w+ V; d4 L% I4 d
syms a b x;
& G9 c m) O! _: Cf1=a*sin(x)+b1 t [4 D" s* p
f2=subs(f1,sin(x),'log(y)')
1 G- K$ {6 r v, h" {; p" G; nclass(f2)
1 ?. G8 G9 v8 i; pf3=subs(f1,a,sym(3.11))
9 r" |; {( v7 z8 Q" U. jclass(f3)3 K0 L) l; [1 Q/ D
f4=subs(f1,x,[0,pi/2,pi])5 d$ ]" @* ]0 m6 u; n
class(f4)
+ g) Q" F' Y2 z- i G8 {/ I/ mformat
% m- S& w( t/ rformat compact' l0 a" `, y8 f: n
t=0:pi/10:2*pi;
; w) u Y Q9 w! w Qf5=subs(f1,{a,b,x},{2.3,t});0 W( l& r' H5 A6 o& B
class(f5)
( _7 [* C5 N& T5 u6 g) dplot(t,f5,'r:','LineWidth',5)
- _3 P( q& X0 t/ b0 |k=[0.6;0.8;1];
' l# Z* L" u2 O) G' h: Wf6=subs(subs(f1,{a,b},{k,2}),x,t);$ t" g) s4 m( |+ w2 H9 N) X, q' m
class(f6)
; C' ^* W- O, z5 E) splot(t,f6)) D6 s- x! ~* n+ n
0 ]! d1 H: Q" U3 Y8 p" F; T" |7 R+ T! H% k6 N4 z
提示错误信息5 D" `5 g! n* t r9 N- y& V, l
错误使用 sym>convertChar (line 1448)
% V# f) _- e' K7 V+ tCharacter vectors and strings in the first argument can only specify a variable or number. To evaluate character vectors and strings0 h% J' \$ z' v& k: _/ }$ S0 ?
representing symbolic expressions, use 'str2sym'.
9 l, c. f5 L) I9 L
( M: X' ?' B8 g }/ R$ ?' d
) f/ G* _& X1 F% F出错 sym>tomupad (line 1214)
7 ?) Y; X9 t% {7 e2 O S = convertChar(x); K2 Q+ J9 l! f" j- r, N
8 j" Z' }4 ^+ T1 G* Y
9 n/ d- ]- _8 D0 |4 C) b. b出错 sym (line 211)' ?' O- t; c. K( f' ~# o$ z
S.s = tomupad(x);
/ i* }2 b& `3 n% Z. M5 ~# C# i# r2 [! f; f' q
3 q/ H0 f. ^) L" P$ i5 D" e4 @
出错 sym/subs>normalize (line 211)7 A J: n6 ~0 `& X8 r6 ]" c
Y = {sym(Y)};
3 A0 | ]% p; \3 o( Z9 S+ ^
+ u0 D* y6 |+ M& \; Z0 n
8 W2 `; r3 h, r2 {出错 sym/subs>mupadsubs (line 157)* p3 [- X: @3 [. w
[X2,Y2,symX,symY] = normalize(X,Y); %#ok+ Y; F0 C' H' Q
& b7 `) ~3 d+ m" ^* b; t
! e/ S) B h" N4 Z5 r出错 sym/subs (line 145)6 {6 I0 g# d4 G7 S) {9 r% P, s: P
- x, V" @. g. v3 T4 }# f/ w
G = mupadsubs(F,X,Y); |
|