photo

Hossein


Aktiv seit 2011

Followers: 0   Following: 0

Nachricht

Hi,

I am using odeXXX for solving a simple ordinary equation. I need to have the solution in different times. For doing so, I though I only need a time span like
timespan=linspace(0,45E-6,88)
but the number of outputs does not have any correlation with the size of timespan

timespan=linspace(0,45E-6,88);
sol=ode45(handle,timespan,y0)

so I am expecting to see 88 answer in the output, but depending on the 'RelTol' the number of output is something about 24 to 290

right now I am using a for loop like this,

for i=1:size(timespan)
sol=ode45(handle, [0 timespan(i)],y0)
y=sol.y(:,end)
end

I am sure there must be a much better and faster way to obtain these results.

Statistik

MATLAB Answers

1 Frage
4 Antworten

RANG
3.773
of 300.771

REPUTATION
14

BEITRÄGE
1 Frage
4 Antworten

ANTWORTZUSTIMMUNG
0.0%

ERHALTENE STIMMEN
1

RANG
 of 21.084

REPUTATION
N/A

DURCHSCHNITTLICHE BEWERTUNG
0.00

BEITRÄGE
0 Dateien

DOWNLOADS
0

ALL TIME DOWNLOADS
0

RANG

of 170.969

BEITRÄGE
0 Probleme
0 Lösungen

PUNKTESTAND
0

ANZAHL DER ABZEICHEN
0

BEITRÄGE
0 Beiträge

BEITRÄGE
0 Öffentlich Kanäle

DURCHSCHNITTLICHE BEWERTUNG

BEITRÄGE
0 Discussions

DURCHSCHNITTLICHE ANZAHL DER LIKES

  • Knowledgeable Level 1
  • First Answer

Abzeichen anzeigen

Feeds

Anzeigen nach

Beantwortet
stopping a function after 30 iterations
Hi, The function that you are using doesn't have any real root. If you change the function to x^2-1 it works perfectly fine. ...

mehr als 13 Jahre vor | 0

Beantwortet
Substituting numbers into a matrix with symbolic values
Is it possible to write a function that does that? like this: function Amat=Amat(x,y,z) Amat=[x+y;y+z;z+x;y+z]; end...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
add two number and create the text file with the result in it
Hi, first create a file using fopen function. It opens/creates to read/write. Because you wanna write use 'w' as permission. f...

mehr als 13 Jahre vor | 1

| akzeptiert

Frage


Passing function handle to another function and assigning varying number of input arguments to it
Hi, I am trying to write a code in which I need to pass a handle function to another function, let say function b=myfun...

mehr als 13 Jahre vor | 1 Antwort | 0

1

Antwort

Beantwortet
Uncertainty
Hi, I think since fminsearch is a derivativ-free method, it cannot calculate the uncertainty of answer. You can use lsqcruvefit ...

etwa 14 Jahre vor | 0