ODE45 - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.


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.