TA的每日心情 | 开心 2019-11-29 15:38 |
|---|
签到天数: 4 天 [LV.2]偶尔看看I
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
4 b# D& Z2 k6 Y! k- i/ G# y, {$ S; e, F" v, p' Z; D( a
这是书上的一段代码,但是用18的matlab运行不了,想请教一下大神如何修改才能运行呢?感谢!3 U& ]: B$ j: F, t* h: C4 j# g
syms a b x;
2 O& B; N" R* _* p4 g5 O" }f1=a*sin(x)+b- N9 C+ T" c# S, Y2 ^
f2=subs(f1,sin(x),'log(y)')
' @0 `! c; N" y5 o1 ]# H* \8 |, O" }class(f2)
8 p3 Y1 }! ~" l5 `. T, {0 H, T; {f3=subs(f1,a,sym(3.11))* t# [( ~. [0 j8 F& T9 x
class(f3)
$ W, d5 O) ^5 |& _0 s/ t9 Ff4=subs(f1,x,[0,pi/2,pi])
2 T Q" a* ~& s7 K1 z6 N7 ^class(f4)# G" z. D7 A1 Y, K
format9 o9 E3 W" v) {6 b, Z8 C0 ?
format compact- _0 N; v) s2 g* f, r6 q! U
t=0:pi/10:2*pi;+ q7 N* P( B J0 L( _8 m, a& x) H
f5=subs(f1,{a,b,x},{2.3,t});
2 N( C3 f9 P+ T$ X* `9 n8 u8 oclass(f5)
' _' ^, D# \1 l" q: r6 B' G% bplot(t,f5,'r:','LineWidth',5)
# G) H- h7 y% j2 Q$ ck=[0.6;0.8;1];
+ ~8 H# j$ x+ p9 y, _: N2 I( Hf6=subs(subs(f1,{a,b},{k,2}),x,t);' c; r) x0 G6 L. Y" n8 {
class(f6)
5 \2 i4 n8 A9 s. \ K$ d8 K" H6 \' hplot(t,f6)
B4 }' U; y0 [# D# M& S! ]' [
! m# l8 ?8 F6 G7 t
7 k( V. W |3 D提示错误信息
# C+ h! s" B8 t9 w; y. ]; N错误使用 sym>convertChar (line 1448)
5 t8 J6 `! z" \2 q4 ]0 dCharacter vectors and strings in the first argument can only specify a variable or number. To evaluate character vectors and strings
' @9 D# h( J+ Rrepresenting symbolic expressions, use 'str2sym'.8 [" ^6 t, r: R8 P: J9 c J
# m% {: q$ x p! U8 p
4 |# M# O$ A* b+ I3 o' A出错 sym>tomupad (line 1214)9 [( h0 ?$ \3 R, T2 v, Q8 _
S = convertChar(x);* r2 f$ |+ u" P* U
# |- M# U1 W3 c! D" G' S
, z! t7 G, E5 l7 |( o( _ C+ x出错 sym (line 211)" t9 ]% ^2 J- g! W0 i+ S5 B" ]
S.s = tomupad(x);5 @" i+ M- C9 q7 P# S5 x
) l6 _7 Y+ i+ j. l( Q# m/ ^
/ u: z6 E& J* \出错 sym/subs>normalize (line 211)+ ~2 ~+ c4 H, x# Y/ `/ r
Y = {sym(Y)};
+ B, s- l" P. @1 x# V' Y
! c$ K+ w0 o# C- \
0 V8 O; v; E. f& f1 {( a: {出错 sym/subs>mupadsubs (line 157)
9 S9 M, w4 s, s[X2,Y2,symX,symY] = normalize(X,Y); %#ok* j9 `+ v1 g- f, J4 k# N/ T
6 {1 }, ]5 V. g& f6 q
8 }6 L @( K+ F9 e$ E出错 sym/subs (line 145)0 E. ? f6 x; A1 _% x' Z+ V" Q
0 ?% a. j% w. _$ o) a! c G = mupadsubs(F,X,Y); |
|