Multiply a derivative matrix with another matrix
이전 댓글 표시
I am trying to multiply the following matrices:
[d/dx 0; 0 d/dy; d/dy d/dx] * [N1 0 N2 0 N3 0 N4 0; 0 N1 0 N2 0 N3 0 N4]
where N1 through N4 are defined equations with systematic variables x and/or y. The output should be a 3x8 matrix.
For example, the (1,1) cell of the output should be the derivative of N1 in terms of x, the (1,3) cell should be the derivative of N2 in terms of x, etc.
How can I do this?
As a second question, I have this line of code: K=vpa(int(int(BT*E*B*t,x,x1,x2),y,y1,y2))
Without vpa, I get answers with large numbers/large numbers. To get it to show as a decimal answer, I used vpa, but now it's showing a large number of decimal places (around 15). I've tried format short, short g, short eng, etc and nothing seems to be working.
How can I get it to display less decimal places?
댓글 수: 1
Lam Nguyen Van
2021년 2월 24일
Take a look: https://www.mathworks.com/matlabcentral/answers/36580-operator-matrix-for-matrix-differentiation
function dNdv = diffmtx(v,N)
% v -vector m x 1 - sym array
% N - matrix m x n - sym array
rz = arrayfun(@(ii)diff(N(ii,:),v(ii)),(1:numel(v)).','un',0);
dNdv = cat(1,rz{:});
end
답변 (1개)
Star Strider
2015년 4월 8일
I know of no way of dealing with your first question other than to take the derivatives of the various functions using the symbolic diff function.
The second question is easy. Specify the number of significant figures you want:
K=vpa(int(int(BT*E*B*t,x,x1,x2),y,y1,y2),5)
This will give you 5 digit results.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!