Begginer's Question about matrixes
Show older comments
For context I'm developing a basic car speed controller, in which I'm using the changes in altitude to determine a slope which will slow down the car. The controller will speed up the car when it is under the desired speed.
Anyway,
I have defined functions as matrix of (1,instances) many different different parameters, one of which is pressure
I am trying to define pressure as a function of altitude , with altitude being a matrix (1,n) of the following type:
altitude = [a,a,a,a,a,b,c,d,e,f,g,h,iiiiii] %a plane a slope and a plane again
and then I tried to calculate the pressure matrix as function of the altitude in each point as well as the difference in pressure between each step:
for s=1:it
press(1,s)=Ps*(1+(Lb/Ts)*altitude(1,s))^(-g0*M/R*Lb); %if youre not familiar with this formula, all the remaining paramters are constants
if s~=it
dp(1,s+1)=k1*(press(1,s+1))-k1*(press(1,s));% k is a gain parameter that I thought might fix this
end
end
but when I plot the pressure as function of altitude I get a downwards slope when I'm pretty sure I should be getting a quadratic
additionally the dp matrix should resemble a derivative of the pressure matrix and it is constant throughout time.
As I said I'm a begginer and perhaps this is not the best method for relating parameters with one another, so I'm open to suggestions.
Additionally I have no idea why it doesn't work so If somebody could clear it up for me I would appreciate it!
Thank you in advance
1 Comment
darova
on 16 Nov 2019
YOu should attach all constants/data and the code you used
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!