Undefined function or variable 'V0'.

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 comentarios

madhan ravi
madhan ravi el 10 de Abr. de 2019
Editada: madhan ravi el 10 de Abr. de 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
Adam el 10 de Abr. de 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
Alastair Combe el 10 de Abr. de 2019
Think of it as original velocity so it is the first value of velocity that is taken into the function for the first iteration of the loop, as opposed to 'vel' which is the velocity after the loop.
The values are for drag and downforce equations
Rho = air density Cz/cd = downforce and drag coefficients A = area

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Multibody Modeling en Centro de ayuda y File Exchange.

Preguntada:

el 10 de Abr. de 2019

Comentada:

el 10 de Abr. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by