필터 지우기
필터 지우기

How can i give difference to Variable

조회 수: 1 (최근 30일)
Light
Light 2013년 6월 8일
How can i give difference to number by '
S
S'
S''
And i will use it in next calculation.
U=S+1
U'=S'+2
P=S''+5 ....etc
But error message appeared

답변 (2개)

Matt J
Matt J 2013년 6월 8일
편집: Matt J 2013년 6월 8일
Not for me. It should Hermitian transpose S for as many times as you apply the '.
>> S=1:5; S'''''''''''
ans =
1
2
3
4
5

Matt J
Matt J 2013년 6월 8일
편집: Matt J 2013년 6월 8일
You haven't shown your error (or the code that generates it), so I have to guess what you are doing, but you cannot include non-alphanumeric characters other than underscores in the names of variables.
In any case, to solve a linear system of equations, you wouldn't define different variables. You would write the equations in matrix-vector form
A*x=b
and solve via
x=A\b
This is MATLAB, after all!
  댓글 수: 3
Matt J
Matt J 2013년 6월 8일
None of what you said implies that S' has to have an apostrophe in its name. You could choose another name for it.
None of what you said that S and S' have to be separate variables, either. You could call them S(1) and S(2) instead, making them part of the same vector, S.
Light
Light 2013년 6월 8일
I've already called them S(1) , S(2) ... (max(onerow)) is variable if it is defined by 2 S'(max(negcolumn)) will be changed S'(2)
But now accepting ur offer i will choose another name.
Thank you!

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by