Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How do I set this differential equation up properly?

3 Ansichten (letzte 30 Tage)
Raymond
Raymond am 16 Sep. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I'm not that experienced but Matlab but I'm learning.
So the thing is as follows. We have a miniature oilrig. It's floating on 2 pontons. Now the conditions are, that the oilrig is lying still and can only move in the vertical direction(up and down). We give the oilrig an initial speed and position(i.e. 1cm from neutral or in the neutral with 0.1m/s speed).
This thing weighs 2.9kg, the both cylinders its float's on have a radius of 4cm and are both 30cm long.
So first of, we thought that the equation would look like: m*a=F_z+F_upward. With F_z the gravitationforce and F_upward the upward force of the water. Rewriting this as:
m*y''-m*g-\rho*V_2cyl*g=0 In which V is the volume of the 2 cylinders in the water which would depend on y aswell as y resembles the height of the oilrig in the water.
Anyways, we got the formula of this V, but it's really long and has some arccos and arcsin in it. Now in the end we end up with a formula which is:
my''-m*g-rho*g*V_2cyl=0 with
V_2cyl=2*lenghtofcylinder*pi*radius^2-0.5*radius^2*(360-2*acosd((radius-normalheight+y)/radius)*pi/180-sind(360-2*acosd((radius-normalheight+y)/radius)))
which actually means my y is here embedded in an acos(asin(y)).
So then I rewrote it like this guide said: link untill I got this matlab script in the end:
clear all
close all
clc
m=2.9225;
radius=0.04;
lenghtofcylinder=0.307;
rho=1000;
g=9.81;
normalheight=0.0195+radius;
springmass=@(t,z)[z(2); -rho*g*2*lenghtofcylinder*pi*radius^2-0.5*radius^2*(360-2*acosd((radius-normalheight+z(1))/radius)*pi/180-sind(360-2*acosd((radius-normalheight+z(1))/radius)))/m+g];
ic=[0.005;0];
tspan=[0 50];
[t,y] = ode45(springmass, tspan, ic);
plot(t,y(:,1)), title('Position vs. Time')
xlabel('t[]')
ylabel('position[m]')
Now when I run it it sais 'Warning: Imaginary parts of complex X and/or Y arguments ignored at line 17( plot(t,y(:,1)), title('Position vs. Time'))'
According to me there shouldn't be any Imaginary parts in the entire script so i must be doing something wrong. Can anyone help me out here?
I know it's a mouthfull but I think it's because the differential equation isn't lineair (asin(acos(y))). But then again, how do I do it?
Thanks in regards, Ray

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by