??? Subscripted assignment dimension mismatch
Mostrar comentarios más antiguos
how do I fix this assignment error?
lambdaMJ = 7.2;
MJ_Flow = (30/60)*2;
A = 100;
B = 1;
C = 70;
D = 4;
E = C + D;
F = A - C - D;
MJ_start=0;
for a=1:100
Num_cylces = 1;
XMJ=(poissrnd(lambdaMJ, A, Num_cylces));
lambdaMJ_sec(a) = mean(XMJ)/10;
%
FMJ_cars_wait = @(T11,MJ_V11) (lambdaMJ_sec(a));
[T11,MJ_V11] = ode45(FMJ_cars_wait,[0,F],MJ_start);
R_G_MJ = MJ_V11(end:end);
%
FMJ_cars_wait_2 = @(T12,MJ_V12) (lambdaMJ_sec(a) - MJ_Flow);
[T12,MJ_V12] = ode45(FMJ_cars_wait_2,[F,A],R_G_MJ);
%
Major_end(a)=MJ_V12(end);
MJ_start=MJ_V12(end);
if MJ_start < 0
MJ_start=0;
else
MJ_start=MJ_start;
end
%
Major1(:,a) = MJ_V11;
end
??? Subscripted assignment dimension mismatch.
Error in ==> Untitled2 at 30
Major1(:,a) = MJ_V11;
Respuesta aceptada
Más respuestas (1)
Make MJ_V11 the same size as Major1(:,a)
5 comentarios
harley
el 5 de Oct. de 2013
Cedric
el 5 de Oct. de 2013
I didn't fully look at your code, but often the issue in such context is that solutions outputted by different calls to ODE solvers are not expressed for the same set of values of the independent variable. We have therefore to interpolate all outputs on the same "grid".
harley
el 5 de Oct. de 2013
Image Analyst
el 5 de Oct. de 2013
Matt, we went over all that in his original question http://www.mathworks.com/matlabcentral/answers/89151-how-to-find-a-mean-across-rows. I told him you can't stick a whole vector into a single element. Not sure why he abandoned that discussion, and asked all over again here.
Cedric
el 5 de Oct. de 2013
See my answer.
Categorías
Más información sobre Linear Algebra en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!