Bicycle
%PLEASE CONSIDER LATE SUBMISSION
clear all
close all
clc
A=input(\'ENTER THE FRONTAL AREA\\n\')
rho=input(\'ENTER THE DENSITY\\n\')
ch=input(\' ENTER 1 to plot Drag Force vs velocity\\n Enter 2 to plot Drag Force vs Drag Coefficeint\\n\')
if ch==1
c_d=input(\'Enter drag coefficient\')
v=[1:50];
D_F=drag_f(rho,A,v,c_d);
plot(v,D_F)
xlabel(\'velocity\')
ylabel(\'Drag Force\')
grid on
end
if ch==2
v=input(\'Enter velocity\')
c_d=[0:.1:2];
D_F=drag_f(rho,A,v,c_d);
plot(D_F,c_d)
xlabel(\'Drag Coefficient\')
ylabel(\'Drag Force\')
grid on
end
function [ y ] = drag_f( rho,A,v,c_d )
%funcion to find drag force on the basis of input
y=rho*A*v.^2*c_d*.5
end