From: Edwin on 13 Jul 2010 05:39 hello everyone, I'm getting error in interp1 when trying to use it with the matrix M eventhough the values are indeed distinct which is the error interp1 is claiming about or am I doing something wrong?, any help?. yi = interp1(M(1:22,2),M(1:22,1),0.0021); M=[9.00000000000000e-06,0.0794328234724282; 9.00000000000000e05,0.0794327830080303; 0.000200000000000000,0.0794158580930622; 0.000500000000000000,0.0775021947253288; 0.000800000000000000,0.0700716753229793; 0.000900000000000000,0.0666367450356137; 0.00100000000000000,0.0629529444660376; 0.00200000000000000,0.0296328610742864; 0.00300000000000000,0.0129529572779240; 0.00400000000000000,0.00588405521525375; 0.00500000000000000,0.00282225993949341; 0.0100000000000000,0.000139202681380924; 0.0200000000000000,2.10439055553126e06; 0.0300000000000000,1.00790214263658e07; 0.0400000000000000,8.87793765390535e09; 0.0500000000000000,1.14977298231698e09; 0.100000000000000,8.11209646405325e13; 0.200000000000000,1.41302738508455e16; 0.300000000000000,2.55098370081839e19; 0.400000000000000,0;0.500000000000000,0; 1,0;] Thanks in advance
From: Cris Luengo on 13 Jul 2010 06:00 "Edwin " <onest30(a)gmail.com> wrote in message <i1hc7n$b1f$1(a)fred.mathworks.com>... > hello everyone, > I'm getting error in interp1 when trying to use it with the matrix M > eventhough the values are indeed distinct which is the error interp1 is claiming about > or am I doing something wrong?, any help?. > > yi = interp1(M(1:22,2),M(1:22,1),0.0021); > > M=[9.00000000000000e-06,0.0794328234724282; > 9.00000000000000e05,0.0794327830080303; > 0.000200000000000000,0.0794158580930622; > 0.000500000000000000,0.0775021947253288; > 0.000800000000000000,0.0700716753229793; > 0.000900000000000000,0.0666367450356137; > 0.00100000000000000,0.0629529444660376; > 0.00200000000000000,0.0296328610742864; > 0.00300000000000000,0.0129529572779240; > 0.00400000000000000,0.00588405521525375; > 0.00500000000000000,0.00282225993949341; > 0.0100000000000000,0.000139202681380924; > 0.0200000000000000,2.10439055553126e06; > 0.0300000000000000,1.00790214263658e07; > 0.0400000000000000,8.87793765390535e09; > 0.0500000000000000,1.14977298231698e09; > 0.100000000000000,8.11209646405325e13; > 0.200000000000000,1.41302738508455e16; > 0.300000000000000,2.55098370081839e19; > 0.400000000000000,0;0.500000000000000,0; > 1,0;] > > Thanks in advance M(21,2) and M(22,2) are both == 0, so the values of X are not distinct. Maybe you intend to do yi = interp1(M(1:22,1),M(1:22,2),0.0021); ? Also, M(1:22,1) is the same as M(:,1) in this case, but easier to read and won't break when you change the length of your array M. Cheers, Cris.
|
Pages: 1 Prev: Patch and different area color for 4 squares Next: Help needed with fminsearch |