How can i give difference to Variable
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
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
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.
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!