what's the program mistake?

조회 수: 11 (최근 30일)
MA
MA 2014년 6월 3일
댓글: MA 2014년 6월 3일
clear all
clc;
syms a b c
w=zeros(3,1);
w(1,1)=3*a+b;
w(2,1)=b+2;
w(3,1)=c-a;
disp(w)
b=3;
disp(w)
  댓글 수: 2
Sara
Sara 2014년 6월 3일
why do you need
syms a b c
MA
MA 2014년 6월 3일
excuse me check the question again

댓글을 달려면 로그인하십시오.

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 6월 3일
w = sym(zeros(3,1))
You preallocated w as a numeric type and then tried to stuff a sym into it. If you preallocate w as a symbolic, it works as expected.
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2014년 6월 3일
You would need to subs-stitude it in
subs(w,b,3)
MA
MA 2014년 6월 3일
subs(w,[a b c],[a 3 c]) now works,thank you so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by