Differentiating Matrices
古いコメントを表示
I have a 2 by 2 matrix and i need to differentiate each term in this matrix by each term in another 2 by 2 matrix so that i end up with a 4 by 4 result. Eventually i will be doing the same thing with 20 by 5 matrices. Is there any way of doing this? Can anybody help please?
4 件のコメント
bym
2011 年 10 月 2 日
what have you got so far?
Haast
2011 年 10 月 5 日
Walter Roberson
2011 年 10 月 5 日
Pasting the code would be a good start. Commenting the code would help after that.
Haast
2011 年 10 月 10 日
回答 (2 件)
Walter Roberson
2011 年 10 月 3 日
0 投票
Is this symbolic or numeric differentiation ? If it is symbolic, is the second matrix containing just one symbol per entry or does it contain expressions? Differentiating with respect to an expression is not easy.
Haast
2011 年 10 月 3 日
0 投票
3 件のコメント
Walter Roberson
2011 年 10 月 3 日
At the MuPad level (not in MATLAB directly):
exprvars := indets(YourExpression) minus Type::ConstantIdents:
partialdiffs := map((thisvar,expression) -> diff(expression,thisvar), exprvars, YourExpression);
Then partialdiffs will be the partial differentials and exprvars will be the variables used for the partials.
You should be able to turn this into something you can feval(symengine,...) without great difficulty.
Haast
2011 年 10 月 5 日
Walter Roberson
2011 年 10 月 5 日
You could do that, but there are alternatives. For example, at the MATLAB level, you might be able to use
diffs_list = simple(subs('map(proc(thisvar,expression) diff(expression,thisvar) end_proc, indets(YourExpression) minus Type::ConstantIdents, YourExpression)', 'YourExpression', your_symbolic_expression));
Unfortunately I do not have the symbolic toolbox myself, so I am not certain it is possible to activate the internal toolkit map() operation in this manner.
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!