MATLAB: I have been faced with the ‘Index exceeds array bounds’ while graphing.

for loopindex exceeds arrayMATLAB

Hey, I am trying to use the for code to plot a graph and it keeps saying that my index exceeds the array bounds. Not sure what to do to correct the loop. Thank you in advance.
Tr=0.85:0.05:1;
MV= 0.15:0.02:1.75
Pr=zeros(length(Tr),81);
Tr=0.85:0.05:1;
for i= 1:length(Tr)
i
MV= 0.15:0.02:1.75;
[Pr(i,:)] = Isotherm(Tr(i));
hplot=semilogy(MV,Pr(i,:),'-')
hold on
set(hplot(i),'color', 'red', 'Marker','o')
set(hplot(i),'color', 'cyan')
set(hplot(i),'color', 'magenta')
set(hplot(i),'color', 'blue')
set(hplot,'linewidth', 1)
end

Best Answer

Tr=0.85:0.05:1;
MV= 0.15:0.02:1.75
Pr=zeros(length(Tr),81);
Tr=0.85:0.05:1;
MV= 0.15:0.02:1.75;
%Range of molar volumes provided by the Brief.
Pr=cell(1,4)
for i = 1:numel(Tr)
Pr{i}= ((8.*(Tr(i)))./((8.*(MV)) - 1) - (27./(64.*(MV.^2))));
end;
hplot=semilogy(MV,Pr{1},'-')
hold on
hplot1=semilogy(MV,Pr{2},'-')
hplot2=semilogy(MV,Pr{3},'-')
hplot3=semilogy(MV,Pr{4},'-')
set(hplot,'color', 'red', 'Marker','o')
set(hplot1,'color', 'cyan')
set(hplot2,'color', 'magenta')
set(hplot3,'color', 'blue')