TA的每日心情 | 开心 2019-11-29 15:38 |
|---|
签到天数: 4 天 [LV.2]偶尔看看I
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
% f) z. U4 s2 \. z" b& z. L# A
$ ~3 g$ b k/ }这是书上的一段代码,但是用18的matlab运行不了,想请教一下大神如何修改才能运行呢?感谢!1 q' [- G+ W: w& L
syms a b x;
# r1 g% [' H! n" r4 R! Y- G. Wf1=a*sin(x)+b
; L5 ~: C% _- I; g4 Df2=subs(f1,sin(x),'log(y)')
! c4 w: u5 O6 H; w6 I% L) Dclass(f2)3 @# S5 p8 V; {2 u! X! X% H
f3=subs(f1,a,sym(3.11))$ E6 g1 I+ e8 n& P% J$ ]! X7 l% N
class(f3)6 L' |, a0 l2 M4 }& W4 s
f4=subs(f1,x,[0,pi/2,pi])9 ]8 P% i9 A- }
class(f4)8 p1 R& g7 I9 R- k5 V' G1 f; g
format
1 ?; C* k9 a& a8 sformat compact$ `* \+ l# Y5 }2 H. x% u+ }
t=0:pi/10:2*pi;! f S# M1 I! b& L: j8 P( Z4 R
f5=subs(f1,{a,b,x},{2.3,t});
6 N8 T5 o% Z( R* o2 fclass(f5)
/ G6 {1 y" [6 X y+ v nplot(t,f5,'r:','LineWidth',5)
# [4 m2 W" b9 ck=[0.6;0.8;1];
1 I+ ?9 m9 x& L2 r+ @' U" Zf6=subs(subs(f1,{a,b},{k,2}),x,t);
7 S/ j- N E1 c ]# eclass(f6)
. j: P, v6 j$ v, v* J# z0 Y- h7 M$ aplot(t,f6)
6 ~, }- T. J4 A" t( K3 ` r9 r) ^8 q# H- r) ^9 i1 d
3 I& y9 o5 G E9 o" S
提示错误信息( n8 B j6 _7 ?$ u+ Z
错误使用 sym>convertChar (line 1448)
: z- |! |' L$ u$ QCharacter vectors and strings in the first argument can only specify a variable or number. To evaluate character vectors and strings
6 U ~( H# E j9 g* Wrepresenting symbolic expressions, use 'str2sym'.
) M1 V( G- b0 V7 R5 ^* }6 D" w9 V. o" o) Y
9 t$ s5 ]. |3 g: P5 t. Y$ o
出错 sym>tomupad (line 1214)6 U$ ?& Y3 y1 [1 l9 h1 E- R
S = convertChar(x);! P3 }, o5 d! m* i
: {0 V) f/ ?' d' u" v& ^0 r. P9 w5 w
出错 sym (line 211)' N' @8 N# K) y- N; o
S.s = tomupad(x);# N( B2 |, f1 S
! g+ w- h* g$ u- F$ O* b" R- A
2 u; s0 X( m7 P- z0 s4 b出错 sym/subs>normalize (line 211)
/ O4 F0 o+ M& y7 R8 Q/ E Y = {sym(Y)};
" t7 ]- j! L5 s5 Z: E+ D' M
4 C' _' H, z( ~6 Y4 g4 v, A3 R/ G) S" n! x
出错 sym/subs>mupadsubs (line 157)
# v5 e" X' g4 g9 s+ ?, b[X2,Y2,symX,symY] = normalize(X,Y); %#ok
8 R) z5 o% R W6 z* V& U2 K" Z3 {% Z" o+ @
" K% j! b2 F6 c; L2 R+ p+ G
出错 sym/subs (line 145)
6 I! s. ~- B" |) T# M& s: g& z. L0 r7 e. n' S3 |# g7 }
G = mupadsubs(F,X,Y); |
|