Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to estimate coefficient of system of ODE with Matlab
    text
    copied!<p>would like to find coefficient of system below which has variable x</p> <pre><code>dS/dt = a1*S+a2*D+a3*F+a10*x dD/dt = a4*S+a5*D+a6*F+a11*x dF/dt = a7*S+a8*D+a9*F+a12*x </code></pre> <p>then i try without variable x, got error</p> <pre><code>dS/dt = a1*S+a2*D+a3*F dD/dt = a4*S+a5*D+a6*F dF/dt = a7*S+a8*D+a9*F function getDE % find [A, fval] = fminsearch(@objFcn, 10*randn(3)); end function objVal = objFcn(A) % time span to be integrated over tspan = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27]; % your desired data x11 = [0.208408965651696e-3 -0.157194487523421e-2 -0.294739401402979e-2 0.788206708183853e-2 0.499394753201753e-2 0.191468321959759e-3 0.504980449104750e-2 0.222150494088535e-2 0.132091821964287e-2 0.161118434883258e-2 -0.281236534046873e-2 -0.398055875132037e-2 -0.111753680372819e-1 0.588868146012489e-2 -0.354191562612469e-2 0.984082837373291e-3 -0.116041186868374e-1 0.603027845850267e-3 -0.448778128168742e-2 -0.127561485214862e-1 -0.412027655195339e-2 0.379387381798949e-2 -0.602550446997765e-2 -0.605986284736216e-2 -0.751396992404410e-2 0.633613424008655e-2 -0.677581832613623e-2]; y11 = [ -21321.9719565717 231.709204951251 1527.92905167191 -32.8508507060675 54.9408176234139 -99.4222178124229 -675.771433486265 42.0838668074923 -12559.3183308951 5.21412214166344*10^5 1110.50031772203 3.67149699000155 -108.543878970269 -8.48861069398811 -521.810552387313 26.4792411876883 -8.32240296737599 -1085.40982521906 -44.1390030597906 -203.891397612798 -56.3746416571417 -218.205643256096 -178.991498697065 -42.2468018350386 .328546922634921 -1883.18308996621 111.747881085748]; z11 = [ 1549.88755331800 -329.861725802688 8.54200301129155 -283.381775745327 -54.5469129127573 1875.94875597129 -16.2230517860850 6084.82381954832 1146.15489803104 -456.460512914647 104.533252701641 16.3998365630734 11.5710907832054 -175.370276462696 33.8045539958636 2029.50029336951 1387.92643570857 9.54717543291120 -1999.09590358328 29.7628085078953 2.58210333216737*10^6 57.7969622731082 -6.42551196941394 -8549.23677077892 -49.0081775323244 -72.5156360537114 183.539911458475]; y_desired = [x11; y11; z11].'; % solve the ODE y0 = y_desired(1,:); [~,y_real] = ode45(@(~,y) A*y, tspan, y0); % objective function value: sum of squared quotients objVal = sum((1 - y_real(:)./y_desired(:)).^2); end </code></pre> <p>error</p> <pre><code>&gt;&gt; getDE ??? Error: File: objFcn.m Line: 15 Column: 7 Expression or statement is incorrect--possibly unbalanced (, {, or [. Error in ==&gt; fminsearch at 205 fv(:,1) = funfcn(x,varargin{:}); Error in ==&gt; getDE at 3 [A, fval] = fminsearch(@objFcn, 10*randn(3)); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload