[color=Blue]Hi everyone! This is my first time I approach to thi solver and a function. Infact I tried to solve my ODE, but it doesn't work.
Please, would you like to help me?
This is my functin:
N.B. i put the data in "datinuscita" file[/color]
function xp=sloshing(t,S)
%scrivi la funzione con il tempo e lo spostamento iniziale
load('datinuscita')
%xp=zeros(2,1);
%xp(1)=S(2)
xp=-omega_s^2*S+omega*mu/ms*d0*sin(omega*t)
end
[color=Blue]and the solver is:
[/color]
clc
tspan = linspace(0,20,101);
y0=[0,0]
[t,S] = ode45(sloshing, tspan, y0);
% Plot of the solution
plot(t,S(:,1))
xlabel('t')
ylabel('solution y')
title('sloshing vassel').
[color=Blue]Please, help me asap.
Thank you in advance
[/color]
Comments
I have attached all my file. You can find the file to input data and a file where they are stored. There are also the function "sloshing" and the solver "sloshingsolv".
This is the error messege:
??? Input argument "S" is undefined.
Error in ==> sloshing at 7
xp=-omega_s^2*S+omega*mu/ms*d0*sin(omega*t)
Error in ==> sloshigosolv at 5
[t,S] = ode45(sloshing, tspan, y0);
Looking forword to hear from you!
you have to call the function in this way (you can see the matlab help to verify it).
[t,S] = ode45([b]@[/b]sloshing, tspan, y0);