Hello Benneth,
The issue you are experiencing arises because the second argument of the MATLAB 'fplot' function is a cell array. Typically, the MATLAB 'fplot' function is designed to plot expressions or functions. In this case, the variable 'P2_ALL' contains a cell array of cells. To address this, here are two potential solutions to plot variable 'P2_ALL' against variable 'theta2'.
1. Convert the Cell Array to a Vector: You can add the following lines of code to your existing script in order to create a vector from the variable 'P2_ALL'.
vecP2 = [P2_ALL{1,:}];
plot(theta2, vecP2);
2. Change 'P2_ALL' from a Cell Array to a Vector: Instead of making variable ‘P2_ALL’ a cell array, you can make it a vector. Here is the updated code:
clc; clearvars
format short g
M1 = 3 ;
P1 = 1 ;
theta2 = 1:1:30 ;
gamma = 1.4 ;
phi = 4.8 ;
syms beta2
tantheta2 = tand(theta2 );
x = 2*cotd(beta2)*((M1^2*((sind(beta2)).^2)-1 ));
y = M1^2*(gamma+cosd(2*beta2))+2 ;
eqn2 = x/y ;
b0=1 ;
for ii=1:numel(theta2 )
T = tantheta2(ii );
clearvars result2
syms beta2
result2 = vpasolve(T== eqn2, beta2,b0 );
beta2 = vpa(result2 );
Mn1 = M1*sind(beta2); % Eqn 4.7 from Anderson's
p2p1 = 1+((2*gamma)/(gamma+1))*(Mn1^2-1); % Eqn 4.9 from Anderson's
Mn2sq= (Mn1^2+(2/(gamma-1)))/((2*gamma/(gamma-1))*Mn1^2-1);% Eqn 4.10 from Anderson's
Mn2 = sqrt(Mn2sq );
M2 = Mn2/sind(beta2-theta2(ii ));
P2 = p2p1*P1 ;
%P2_ALL vector of sym
P2_ALL(ii)=vpa(P2) ;
end
plot(theta2,P2_ALL);
With following either of the approach, you can plot the variable ‘P2_ALL’ against ‘theta2’. The result can be shown as the figure attached below.

For more information on MATLAB ‘fplot’ function, please refer to the documentation given below.
Hope this resolves the query.