Hossein - MATLAB Central
photo

Hossein


自 2011 起处于活动状态

Followers: 0   Following: 0

消息

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.

统计学

MATLAB AnswersFrom 10/11 to 04/25Use left and right arrows to move selectionFrom 10/11Use left and right arrows to move left selectionTo 04/25Use left and right arrows to move right selectionUse TAB to select grip buttons or left and right arrows to change selection100%
MATLAB Answers

1 个提问
4 个回答

排名
3,877
of 298,247

声誉
14

贡献数
1 个提问
4 个回答

回答接受率
0.0%

收到投票数
1

排名
 of 20,553

声誉
N/A

平均
0.00

贡献数
0 文件

下载次数
0

ALL TIME 下载次数
0

排名

of 160,685

贡献数
0 个问题
0 个答案

评分
0

徽章数量
0

贡献数
0 帖子

贡献数
0 公开的 个频道

平均

贡献数
0 个亮点

平均赞数

  • Knowledgeable Level 1
  • First Answer

查看徽章

Feeds

排序方式:

已回答
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. ...

13 years 前 | 0

已回答
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...

13 years 前 | 0

| 已接受

已回答
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...

13 years 前 | 1

| 已接受

提问


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...

13 years 前 | 1 个回答 | 0

1

个回答

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

13 years 前 | 0