calculating the array correctly, yet when recalling it for displying on surf plot its just a flat surface

 채택된 답변

Image Analyst
Image Analyst 2022년 4월 30일

0 개 추천

How did you paste that code in there? I can't copy it. You didn't paste an image did you? We can't run an image. Post your code as code, or else attach it with the paperclip icon.
What is "laptime"? It doesn't change inside the loop so it's not surprising your array is all the same value.
Anyway, plot is a function. Do not use it as a variable name.

댓글 수: 5

%Sensitivity Analysis
Axisl = [0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.1];
plot = zeros;
for k = 1:21
m = 650 * Axisl (k);
%D_Weight = 0.46 * Axis1 (k);
%R_Weight = 1-D_Weight;
%CDA = 0.35 * Axis1 (k);
%CLA2 = 0.50 * Axis1 (k)
%CoG = 275 * Axis1 (k);
%mu_long = 1.45 * Axis1 (k);
%mu_lat = 1.38 * Axis1 (k);
%D_Aero2 = 0.45 * Axis2 (k);
%R_Aero = 1-D_Aero2;
%FinalDR = 10/37 * Axis1 (k);
for j = 1:21
%m = 650 * Axis1 (j);
%D_Weight = 0.46 * Axis1 (j);
%R_Weight = 1-D_Weight;
%CDA = 0.35 * Axis1 (j);
%CLA2 = 0.50 * Axis2 (j);
%CoG = 275 * Axis1 (j);
mu_long = 1.45 * Axisl (j);
mu_lat = 1.38 * Axisl (j);
%D_Aero2 = 0.45 * Axis1 (j);
%R_Aero = 1-D_Aero2;
%GearRatio = 21/29 * Axis1 (j);
%Sensitivity Analysis End
plot (k,j) = Laptime;
end
end
Unrecognized function or variable 'Laptime'.
surf(plot)
xlabel('Mass = -10% -> +10%')
ylabel('Weight Distribution 10% -> 10%')
zlabel('LapTime (s)')
Image Analyst
Image Analyst 2022년 4월 30일
Again, what is Laptime and how is it supposed to change upon every iteration?
fraser watts
fraser watts 2022년 4월 30일
laptime = 38.1615 btw
fraser watts
fraser watts 2022년 4월 30일
just realised it wont work need to change original code to then refernce laptime as an array into this new section, appriciate the repsonses though
Image Analyst
Image Analyst 2022년 5월 1일
편집: Image Analyst 2022년 5월 1일
@fraser watts, if you have Laptime defined in advance somehow you can perhaps do
myPlot(k,j) = Laptime(k, j);

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2022년 4월 30일

0 개 추천

Every iteration you are storing the exact same value Laptime, which never changes.

제품

릴리스

R2022a

태그

질문:

2022년 4월 30일

편집:

2022년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by