Cutting for loop connected with cell matrix
2 次查看(过去 30 天)
显示 更早的评论
Hi all
i have a for loop capable to solve multiple times an ODE system. It gives me, as solution for the system, a cell matrix Nx7(YSol) where each cell has dimensions Nx3. I want to obtain a cell matrix where each element of the third column of each cell is less than one, neglecting all the bigger values. I have tried something like that but with no success:
Nc=0.01;
P0=2.200000e+05;
T0=300;
Tt0=T0;
Pt0=P0;
L=0.1:0.7:1;
Mo1=[0.500000000000000,0.600000000000000,0.700000000000000];
ChT=[0.00289672891258433,0.00279011328296122,0.00270449699691686];
fT=[0.00438845212769167,0.00419291495433692,0.00403440372566407];
for i=1:length(L)
for j=1:length(Mo1)
Y0(j)={[Tt0,Pt0,Mo1(j)]};
ChT_cell(j)={ChT(j)};
ft_cell(j)={fT(j)};
Dall(i) ={[0:Nc:L(i)]};
end
end
Aeffettivafinal=7.828541323557411e-07;
Perimetro=0.011112388980385;
for i=1:length(L)
[~,siz(i)]=size(Dall{1,i});
end
for i=1:length(siz)
for iDom = 1:numel(Dall)
xRange = Dall{iDom};
for iInitial = 1:numel(Y0)
Ch=ChT_cell{iInitial};
Fc=ft_cell{iInitial};
[xSol{iDom,iInitial},YSol{iDom,iInitial}]=ode23(@(x,Y) ...
chambsinglebobb(x,Y,Ch,Aeffettivafinal,Perimetro,Fc),xRange,Y0{iInitial});
if YSol{iDom,iInitial}(1:siz(i),3)>1.00000000001
break;
end
end
end
end
The code has very long computational times, due to achievement of values equal 1 in the third column of the cells of the cell matrix. The creation of this break code has the purpose of avoiding such long times
Regards
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!