Plotting With Arrays on Surf Function

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 件のコメント

fraser watts
fraser watts 2022 年 4 月 30 日
編集済み: Image Analyst 2022 年 4 月 30 日
%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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by