Index in position 1 exceeds array bounds (must not exceed 1)
Show older comments
Hello, I'm trying to run this code, but i get an error message :Index in position 1 exceeds array bounds (must not exceed 1). the error message comes from "psR60_1=PnR60_1(sizeR60,1); %peso seco". What does "Index in position 1 exceeds array bounds (must not exceed 1)" mean? and how to solve this?
Here is the code :
%Modelo de secado para zanahorias cortadas en rodajas con un ancho de 0.5 cm
%Tres temperaturas de secado fueron usadas (60, 65 y 70°C) y cada experimento se realizó por triplicado. Los promedios de humedad de los triplicados fueron usados para calcular y modelar la difusividad, así como para modelar la pérdida de humedad con modelos empíricos de capa delgada.
%Para la rodajas, 3 rodajas (2.1 cm diámetro) fueron puestas en una bandeja de aluminio
%Área de secado de las rodajas (cm^2)
AR=4*(pi*((2.1/2)^2));
L=0.5; %longitud característica (cm)
%Peso (g) de la bandeja de aluminio para las rodajas
%Definir el vector de tiempo (min) para el experimento
tR60=[0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240];
tR65=[0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240];
tR70=[0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240];
%Definir los vectores de peso (g) para el experimento
pR60_1=[44 41 37 33 30 27 24 21 19 18 16 14 13 10 10 8 8 6 6 5 5 5 5 5 5];
pR60_2=[44 41 37 33 30 27 24 21 19 18 16 14 13 10 10 8 8 6 6 5 5 5 5 5 5];
pR60_3=[44 41 37 33 30 27 24 21 19 18 16 14 13 10 10 8 8 6 6 5 5 5 5 5 5];
pR65_1=[44 41 37 34 31 27 25 23 18 16 15 12 10 10 10 10 9 8 8 6 6 5 5 5 5];
pR65_2=[44 41 37 34 31 27 25 23 17 16 15 11 10 10 10 10 9 8 8 6 6 5 5 5 5];
pR65_3=[44 41 37 34 31 26 24 23 18 16 15 12 10 10 10 10 9 9 8 7 5 5 5 5 5];
pR70_1=[44 42 38 35 31 27 23 21 19 16 14 12 11 10 10 7 7 7 7 7 6 6 6 6 6];
pR70_2=[44 42 39 35 30 27 24 20 19 17 14 13 12 11 11 8 8 8 8 8 6 6 6 6 6];
pR70_3=[44 41 38 35 31 28 23 21 19 16 15 13 12 9 9 7 7 7 7 7 6 6 6 6 6];
%Calcular el peso neto del producto (g) para el experimento
PnR60_1=pR60_1;
PnR60_2=pR60_2;
PnR60_3=pR60_3;
PnR65_1=pR65_1;
PnR65_2=pR65_2;
PnR65_3=pR65_3;
PnR70_1=pR70_1;
PnR70_2=pR70_2;
PnR70_3=pR70_3;
%Calcular la humedad (g) para el experimento. Asumiendo que el peso seco de la muestra es el peso neto.
sizeR60=length(tR60); %tamaño del peso neto
psR60_1=PnR60_1(sizeR60,1); %peso seco
phR60_1=PnR60_1-psR60_1; %peso húmedo
psR60_2=PnR60_2(sizeR60,1); %peso seco
phR60_2=PnR60_2-psR60_2; %peso húmedo
psR60_3=PnR60_3(sizeR60,1); %peso seco
phR60_3=PnR60_3-psR60_3; %peso húmedo
sizeR65=length(tR65); %tamaño del peso neto
psR65_1=PnR65_1(sizeR65,1); %peso seco
phR65_1=PnR65_1-psR65_1; %peso húmedo
psR65_2=PnR65_2(sizeR65,1); %peso seco
phR65_2=PnR65_2-psR65_2; %peso húmedo
psR65_3=PnR65_3(sizeR65,1); %peso seco
phR65_3=PnR65_3-psR65_3; %peso húmedo
sizeR70=length(tR70); %tamaño del peso neto
psR70_1=PnR70_1(sizeR70,1); %peso seco
phR70_1=PnR70_1-psR70_1; %peso húmedo
psR70_2=PnR70_2(sizeR70,1); %peso seco
phR70_2=PnR70_2-psR70_2; %peso húmedo
psR70_3=PnR70_3(sizeR70,1); %peso seco
phR70_3=PnR70_3-psR70_3; %peso húmedo
%Calcular humedad en base seca (g) para el experimento
hbsR60_1=phR60_1./psR60_1;
hbsR60_2=phR60_2./psR60_2;
hbsR60_3=phR60_3./psR60_3;
hbsR65_1=phR65_1./psR65_1;
hbsR65_2=phR65_2./psR65_2;
hbsR65_3=phR65_3./psR65_3;
hbsR70_1=phR70_1./psR70_1;
hbsR70_2=phR70_2./psR70_2;
hbsR70_3=phR70_3./psR70_3;
%Gráfica de humedad, promedio
hbs_prom_R60=(hbsR60_1+ hbsR60_2+ hbsR60_3)./3;
hbs_prom_R65=(hbsR65_1+ hbsR65_2+ hbsR65_3)./3;
hbs_prom_R70=(hbsR70_1+ hbsR70_2+ hbsR70_3)./3;
figure (1)
plot (tR60, hbs_prom_R60, ‘*r’)
hold on
plot (tR65, hbs_prom_R65, ‘*b’)
plot (tR70, hbs_prom_R70, ‘*g’)
title(‘Contenido de humedad en base seca vs. tiempo)
xlabel(‘tiempo (min)’)
ylabel(‘Humedad b.s. (gH2O/gS.S)’)
legend(‘60°C’,’65°C’, ‘70°C’)
1 Comment
Alejandro Peñuelas
on 30 May 2020
You can also help us to help you: can you edit the question and format the code with the 'code' option of this page.

Press that button and paste your code inside the box that will appear in the editor. This helps with the format of the code. By doing so, when we can copy and paste the code correctly without format problems. Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


