Undefined function or variable 'V0'.
Show older comments
I am running a laptime simulation for a formula 1 car. When coding the corner speeds and times part of the simulation i keep getting V0 as an undefined variable when i can not define it with a number as that is not what the laptime simulator does. I need to know how to make the simulation run and produce its own values for V0 and other velocities without me having tom define V0 at the start.
This for a 3rd year dissertation project so any help at all would be great and i will provide any code and information i can.
Thanks in advance.
cnr = 1;
for i=1:nseg
rad = track(i,2);
if rad ~= 0
dist = track(i,1);
[cnrVel(cnr),cnrTimes(cnr)] = calcCornerSpeed(rad,dist,cz,mu,m,A,V0);
cnrNum(cnr) = i;
cnr = cnr + 1;
end
end
function [vel,t] = calcCornerSpeed(rad,dist,cz,mu,m,A,V0)
rho = 1.225;
Fz = 0.5*rho*cz*(V0.^2) + m*9.81;
vel = sqrt((rad*mu/m)*Fz);
t = dist./vel;
if (vel-V0)^2 > 0.0001
[vel,t] = calcCornerSpeed(rad,dist,cz,mu,m,A,vel);
end
end
3 Comments
madhan ravi
on 10 Apr 2019
Edited: madhan ravi
on 10 Apr 2019
According to what I understand , you have no idea what v0 value should be? Please define explicitly what the variables represent and the values. Please note description is needed. +1 to the question , I am a Formula 1 fan ;).
Adam
on 10 Apr 2019
From a purely Matlab perspective you are passing v0 into your function without having defined it anywhere. Your function itself does not calculate v0 so it has to be provided from somewhere if you expect to use it. Where you get it from sounds more like a domain problem than a Matlab problem.
Alastair Combe
on 10 Apr 2019
Answers (0)
Categories
Find more on Multibody Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!