problem in solve function
古いコメントを表示
hello I write a m-file that gets the number of equation and solve a system of equation.i use 'solve' function to calculate the roots of system but i get the answer in a structure format and for every roots i must enter the format "q.w1_1" for example. i want to ask how can i get the whole roots in a matrix format?i write the answer of matlab bellow. thank you
q =
w10_1: [1x1 sym]
w10_2: [1x1 sym]
w10_3: [1x1 sym]
w10_4: [1x1 sym]
w10_5: [1x1 sym]
w10_6: [1x1 sym]
w10_7: [1x1 sym]
w10_8: [1x1 sym]
w10_9: [1x1 sym]
w10_10: [1x1 sym]
w1_1: [1x1 sym]
w1_2: [1x1 sym]
w1_3: [1x1 sym]
w1_4: [1x1 sym]
w1_5: [1x1 sym]
w1_6: [1x1 sym]
w1_7: [1x1 sym]
w1_8: [1x1 sym]
w1_9: [1x1 sym]
2 件のコメント
KSSV
2016 年 1 月 6 日
Can you copy the code here, which gave you that structure? It makes solution easy.
mahmud man
2016 年 1 月 6 日
編集済み: Walter Roberson
2016 年 1 月 6 日
回答 (1 件)
Walter Roberson
2016 年 1 月 6 日
編集済み: Walter Roberson
2016 年 1 月 6 日
struct2cell(q)
and you might want to cell2mat() the result of that.
But remember that when you do these, you are making a result that depends upon the order of the symbols -- dependent, for example, on the fact that w10_1 sorts before w1_1 because '0' sorts before '_' .
2 件のコメント
mahmud man
2016 年 1 月 6 日
Walter Roberson
2016 年 1 月 6 日
If you are looking for the double precision value equivalent then
bb = structfun(@double,q);
If you are looking for the answer still in symbolic form then
aa = struct2cell(q);
bb = vertcat(qq{:});
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!