Technical Solutions
Why do I receive a an error when specifying two event functions to the ODE solvers within MATLAB 7.0 (R14)?
Date Last Modified: 06 Nov 2007
| Solution ID: | 1-QAZDS | |
| Product: | MATLABĀ® | |
| Reported in Release: | R14 | |
| Fixed in Release: | R14SP2 | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
Why do I receive a an error when specifying two event functions to the ODE solvers within MATLAB 7.0 (R14)?
Problem Description:
To reproduce this error, save the following code within an M-file, and then execute.
function mysoup
options = odeset('Stats', 'on', 'Events', @ex19ach1e);
tspan = [0 2];
y0 = [0 ; 0];
yspan=(1:9)'/10;
[t,y,te,ye,ie] = ode45(@ex26ch2f,tspan, y0, options,yspan);
disp('te = '), disp(te)
function yprime = ex26ch2f(t,y,yspan)
yprime = [y(2) ; 1/2];
function [value, isterminal, direction] = ex19ach1e(t,y,yspan)
isterminal = zeros(size(yspan)); direction = zeros(size(yspan));
value = y(1) - yspan;
I receive the following error message;
??? Error using ==> horzcat
All matrices on a row in the bracketed expression must have the
same number of rows.
Solution:
This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds: |
|
|
Store