for loop with syms variable

조회 수: 3 (최근 30일)
Tony Yu
Tony Yu 2020년 6월 29일
댓글: madhan ravi 2020년 6월 29일
I am trying to make a loop such that will generate c1=cos(th1) c2=cos(th2).....etc, how can I fix this?
syms th th1 th2 th3 th4 th5 th6
for N=1:6
c(N)=cos(th(N));
end

채택된 답변

madhan ravi
madhan ravi 2020년 6월 29일
편집: madhan ravi 2020년 6월 29일
% Newer versions
syms th [1, 6]
c = cos(th)
%Older versions
th = sym('th', [1, 6]);
syms(th)
c = cos(th)
  댓글 수: 2
Tony Yu
Tony Yu 2020년 6월 29일
thanks for suggestion, but that only gives c =
[ cos(th1), cos(th2), cos(th3), cos(th4), cos(th5), cos(th6)]

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by