Excluding elements from array

4 ビュー (過去 30 日間)
Nicolas
Nicolas 2024 年 3 月 30 日
編集済み: Voss 2024 年 3 月 30 日
I need help trying to exclude values past position 19 from an array of 295. I have tried using the exlude command but was unable to understand the syntax. The array is converted from a table of data into StrainA. Then the data is checked to see at which point the graph is non-linear. I then only want to graph the regression line for that data. WhennonLinear = 19 for this data set. I cannot send the data file.
Example:
Force = TensileTestData(:,7);
Area = 4 * .25;
Stress = Force ./ Area;
Strain = TensileTestData(:,6);
StrainA= table2array(Strain);
StressA =table2array(Stress);
PositionNonLin = ischange(StressA,'linear', 'MaxNumChanges',1);
WhennonLinear = find(PositionNonLin==1);
RegStrainA = exclude(StrainA,[:,WhennonLinea:end]);
Regression = fitlm(RegStrainA,StressA);
figure(1)
hold on
scatter(StrainA, StressA)
plot (Regression)
title('Tensile Test')
xlabel("Strain")
ylabel("Stress")
hold off
  1 件のコメント
Voss
Voss 2024 年 3 月 30 日
編集済み: Voss 2024 年 3 月 30 日
By the way, you can get the values out of the table directly by using curly braces instead of parentheses:
Force = TensileTestData{:,7};
Area = 4 * .25;
StressA = Force ./ Area;
StrainA = TensileTestData{:,6};
Then you can omit the table2array lines.

サインインしてコメントする。

採用された回答

Voss
Voss 2024 年 3 月 30 日
WhennonLinear = find(PositionNonLin==1);
Regression = fitlm(StrainA(1:WhennonLinear-1),StressA(1:WhennonLinear-1));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by