Question: Pretty please help me fix my MATLAB code, I've been struggling for quite some time. I hope I've included enough context information to help with

Pretty please help me fix my MATLAB code, I've been struggling for quite some time. I hope I've included enough context information to help with the MATLAB portion of the project.
Notes
utilize MATLAB function "ode45" to solve the system equations
Each plot should include 2 curves
The first curve should show the pedal force (Fp ). The second curve should show the CVT shift angle (\theta ) or theta.
Both curves should be plotted as a function of time. The simulation should start at time t =0 and continue at least until the pedal force falls within 2% of the desired FD (the response time)% script that represents an accurate model of the automatic bicycle transmission
% Initial shift angle (deg): -15.0
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% author [335]
% version [1.0]
% date [2024.09.27]
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DESCRIPTION OF VARIABLES
%
%
% START OF EXECUTABLE CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% List of parameters in structure form
close; clear; clc;
params.wi =(2*pi)/(0.121); %rad/s
params.c3=384;
params.ri =20.7; %mm
params.c2=3.176;
params.c1=0.121;
params.rp =170; %mm
params.rv =25.9; %mm
params.k =2.24;%N/mm
params.T_level =(8.6*1000); %N-mm
params.theta0=-15*(pi/180); %rad
tspan = linspace(0,15,1000); %s
Tin = zeros(length(tspan),1);
Fp = zeros(length(tspan),1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[t, theta]= ode45(@(t, theta) eq1(t, theta, params), tspan, params.theta0);
plot(t, theta*180/pi,'r');
hold on;
%[t, Fp]= ode45(@(t, Fp) eq5(t, theta, params), tspan, params.theta0);
%hold off;
xlabel('Time (s)');
ylabel('Theta and Fp');
for i=1:length(t)
Tin(i)= eq6(params, t(i), theta(i));
Fp(i)= Tin(i)/(
params.cl *params.rp);
end
plot(t, Fp,'b')
% Equation 1: de/dt
function dtheta_dt = eq1(t, theta, params)
x = eq2(params, t, theta);
dtheta_dt =(params.wi /(params.c3* params.ri))* x;
end
% Equation 2: x(t)
function x = eq2(params,}t\mathrm{, theta)
F_set = eq4(params);
%Fp= eq5(params);
Fc}=\mathrm{ eq3(params, t, theta);
x =(1/params.k)*(2*Fc - F_set);
end
% Equation 3: Fc(t)
function FC = eq3(params, t, theta)
Fp = eq5(params, t, theta);
FC =((params.c1* params.rp)/ params.rv)* Fp;
end
% Equation 4: F_set(t)
function F_set = eq4(params)
F_set =((params.c1* params.rp)/ params.rv)*156;
end
% Equation 5: Fp(t)
function Fp = eq5(params, t, theta)
Tin eq6(params, t, theta);
Fp = Tin /(params.c1* params.rp);
end
% Equation 6: Tin(t)
function Tin = eq6(params, t, theta)
TRN = eq7(params, t);
Tin =(TRW / params.c2)*(1-tan(theta))/(1+tan(theta));
end
% Equation 7: TRW
function TRW = eq7(params, t)
end
Pretty please help me fix my MATLAB code, I've

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!