*--------------------------------------------------------------* * Test Problem 4 from Chapter 8, section 5.6 * * Respiratory Mechanical Model * * * * Note: Since the model is complex, the real component is * * variable 1, and the imaginary is variable 2 * *--------------------------------------------------------------* Sets m number of data sets /1*6/ n number of variables /1*2/ p number of parameters /1*5/; Parameters ze(m,n) observed data values w(m) model constant std(n) standard deviations; Variables z(m,n) fitted data variables a(p) model parameters c cost function; table ze(m,n) 1 2 1 5.0 -5.0 2 3.0 -2.0 3 2.0 -1.0 4 1.5 -0.5 5 1.2 -0.2 6 1.1 -0.1; std(n) = 1; w(m) = ord(m)*3.14159/20; Equations obj objective function conr(m) real part of the model coni(m) imaginary part of the model; obj.. c =e= sum(m,sum(n,sqr((z(m,n)-ze(m,n))/std(n)))); conr(m) .. -z(m,'1') + a('1') + a('2')/(w(m)**a('3')) =e= 0; coni(m) .. -z(m,'2') + w(m)*a('4') - a('5')/(w(m)**a('3')) =e= 0; model problem /obj,conr,coni/; z.lo(m,n) = ze(m,n) - 1; z.up(m,n) = ze(m,n) + 1; a.lo('1') = 0.0; a.lo('2') = 0.0; a.lo('3') = 1.1; a.lo('4') = 0.0; a.lo('5') = 0.0; a.up('1') = 1.0; a.up('2') = 1.0; a.up('3') = 1.3; a.up('4') = 1.0; a.up('5') = 1.0; z.l(m,n) = uniform(z.lo(m,n),z.up(m,n)); a.l(p) = uniform(a.lo(p), a.up(p)); solve problem using nlp minimizing c;