Plot not showing the desired markers and does not match the legend
Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5);Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5); Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5); matlab, plot, markers, legend MATLAB Answers — New Questions