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

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
Star Strider 2015년 4월 8일

0 개 추천

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에 대해 자세히 알아보기

질문:

2015년 4월 8일

댓글:

2021년 2월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by