Funktion for a floating masspoint in 3D
Hey guys,
I´m new to matlab and I want you to ask you some questions.
First of all, I want to plot a floating masspoint on a 3D surface, so I try to figure out how to get the gradient, angle of the surface and at last but not least to get a differential equation.
My code looks like this:
%% paramter
h=0.0002; %
g=-9.81; %gravity
u=0.2; %friction
x0=-12;
y0=-12;
%% gradienten
fgradx = ((x0+h,y0)-(x0-h,y0))/2*h;
fgrady = ((x0,y0+h)-(x0,y0-h))/2*h;
%% angle
winkelx = atan((boden(x + h, c) – boden(x – h, c))/(2*h));
winkely = atan((boden(y + h, c) – boden(y – h, c))/(2*h));
%% Differential Equation
F=[Y(2);Y(3);cos(winkelx)*((sin(winkelx)*g*m)-(cos(winkelx)*m*g*u));cos(winkely)*((sin(winkely)*g*m)-(cos(winkely)*m*g*u))];
So I want you to know, if the code is fine or if i messed up. Would be nice, if you can give me some tips :).
Have a nice day.Hey guys,
I´m new to matlab and I want you to ask you some questions.
First of all, I want to plot a floating masspoint on a 3D surface, so I try to figure out how to get the gradient, angle of the surface and at last but not least to get a differential equation.
My code looks like this:
%% paramter
h=0.0002; %
g=-9.81; %gravity
u=0.2; %friction
x0=-12;
y0=-12;
%% gradienten
fgradx = ((x0+h,y0)-(x0-h,y0))/2*h;
fgrady = ((x0,y0+h)-(x0,y0-h))/2*h;
%% angle
winkelx = atan((boden(x + h, c) – boden(x – h, c))/(2*h));
winkely = atan((boden(y + h, c) – boden(y – h, c))/(2*h));
%% Differential Equation
F=[Y(2);Y(3);cos(winkelx)*((sin(winkelx)*g*m)-(cos(winkelx)*m*g*u));cos(winkely)*((sin(winkely)*g*m)-(cos(winkely)*m*g*u))];
So I want you to know, if the code is fine or if i messed up. Would be nice, if you can give me some tips :).
Have a nice day. Hey guys,
I´m new to matlab and I want you to ask you some questions.
First of all, I want to plot a floating masspoint on a 3D surface, so I try to figure out how to get the gradient, angle of the surface and at last but not least to get a differential equation.
My code looks like this:
%% paramter
h=0.0002; %
g=-9.81; %gravity
u=0.2; %friction
x0=-12;
y0=-12;
%% gradienten
fgradx = ((x0+h,y0)-(x0-h,y0))/2*h;
fgrady = ((x0,y0+h)-(x0,y0-h))/2*h;
%% angle
winkelx = atan((boden(x + h, c) – boden(x – h, c))/(2*h));
winkely = atan((boden(y + h, c) – boden(y – h, c))/(2*h));
%% Differential Equation
F=[Y(2);Y(3);cos(winkelx)*((sin(winkelx)*g*m)-(cos(winkelx)*m*g*u));cos(winkely)*((sin(winkely)*g*m)-(cos(winkely)*m*g*u))];
So I want you to know, if the code is fine or if i messed up. Would be nice, if you can give me some tips :).
Have a nice day. 3d plot, ball, gradient, angl, differential equations MATLAB Answers — New Questions