partial derivatives matrix and Integrations

11 views (last 30 days)
Kindly requesting your assistance, I am running the following code and I am getting some errors. I am trying to get the partial derivative of a matrix in terms of X and Y. Based on the research I have conducted, it says that I could utilize the gradient option, but the error says "too many output arguments".
Also, for integrations would it be possible to get the feedback if I am coding it correctly. The X integration is from 0 to 4 and y from 0 to 3. I ran the code, but since I am getting the error for the partial derivative the code will not run the last part.
E=30*10^6;
v=.3;
t=.1; %inches - Thickness
a=4/2;
b=3/2;
x1=0;
x2=4;
x3=4;
x4=0;
y1=0;
y2=0;
y3=3;
y4=3;
syms x
syms y
D=(E/(1-v^2))*[1 v 0;v 1 0; 0 0 ((1-v)/2)];
h1=(1/(4*a*b))*(x-x2)*(y-y4);
h2=-(1/(4*a*b))*(x-x1)*(y-y3);
h3=(1/(4*a*b))*(x-x4)*(y-y2);
h4=-(1/(4*a*b))*(x-x3)*(y-y1);
H=[h1 0 h2 0 h3 0 h4 0; %X
0 h1 0 h2 0 h3 0 h4]; %Y
[HX,HY]=gradient(H);
B=D*[HX,HY]*t;
K=(int(int(B,x,0,4),y,0,3))

Answers (1)

Abhishek Kolla
Abhishek Kolla on 11 Nov 2021
Hi,
In the above code the output of gradient will return x and y components of the two dimensional numerical gradient of matrix F. More detailed explanation on gradient can be found here Numerical gradient - MATLAB gradient (mathworks.com)
Define any interval range for both x and y after declaring x and y
x = -2:0.2:2;
y = x';
After making the following changes the gradient function will work and both HX,HY will be obtained

Community Treasure Hunt

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

Start Hunting!