How can I sive Error using plot Vectors must be the same lengths.
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Input Data Pm=8.57; Ps=19; PV=7; YP=7; ROP=54; RPM=80; Dcut=0.175; Dp=2.375; Dh=5; %Calculation of Cutting Velocity Cconc=(0.01778*ROP)+0.505; Vcut=ROP/(36*(1-(Dp/Dh)^2)*Cconc); %Calculation of Slip Velocity Vs1=1; n=0; Vslip=0.2; while(abs(Vslip-Vs1)>0.001) n=n+1; Vmin=Vcut+Vslip; Ua=PV+(5*YP*(Dh-Dp))/Vmin; Re=(928*Pm*Dcut*Vs1)/Ua; if (Re<3) f=40/Re; elseif ((Re>3)&&(Re<300)) f=22/sqrt(Re); else f=1.54; end Vslip=f*(sqrt(Dcut*((Ps-Pm)/Pm))); Vs1=(Vslip+Vs1)/2; end %Calculation of Critical velocity Ang=zeros(90); for i=(1:90) Ang(i)=i; if (Ang(i)<=45) Vcrit=Vcut+Vslip*(1+(Ang(i)*(600-RPM)*(3+Pm)/202500)); else Vcrit=Vcut+Vslip*((1+(3+Pm)*(600-RPM)/4500)); end end plot(Ang,Vcrit) grid on title('Graph of Minimun Velocity against Hole Angle') xlabel('Angle (deg)') ylabel('Min Velocity (ft/sec)')
Answers (1)
Star Strider
on 21 Mar 2015
Your ‘Ang’ variable is a (90x90) matrix, ‘Vcrit’ is a scalar.
Change ‘Ang’ to a vector, subscript ‘Vcrit’ in the last loop before the plot, and the plot works:
%Calculation of Critical velocity
Ang=zeros(90,1); % <— Second Argument (‘1’) Creates Vector
for i=(1:90)
Ang(i)=i;
if (Ang(i)<=45)
Vcrit(i)=Vcut+Vslip*(1+(Ang(i)*(600-RPM)*(3+Pm)/202500));
else
Vcrit(i)=Vcut+Vslip*((1+(3+Pm)*(600-RPM)/4500));
end
end
2 Comments
Emeka Igwilo
on 22 Mar 2015
Star Strider
on 22 Mar 2015
My pleasure!
If my Answer solved your problem, please Accept it.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!