ODE45 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!



kelelkelel Posts: 3Member
[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



[color=Blue]and the solver is:

tspan = linspace(0,20,101);
[t,S] = ode45(sloshing, tspan, y0);

% Plot of the solution
ylabel('solution y')
title('sloshing vassel').

[color=Blue]Please, help me asap.

Thank you in advance



  • giuggiug Posts: 217Member
    why "it doesn't work"? does it give you some error? please, attach some test input data so that I can try the code and check where is the problem.
  • kelelkelel Posts: 3Member
    Hello giug!! Many thanks to answer quickly!
    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

    Error in ==> sloshigosolv at 5
    [t,S] = ode45(sloshing, tspan, y0);

    Looking forword to hear from you!

  • giuggiug Posts: 217Member
    I think that one error is that you miss the function handle @.

    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);
Sign In or Register to comment.