- circumferential "increasing pressure"
- circumferential "decreasing pressure"
- axial "increasing pressure"
- axial "decreasing pressure"
Help with Linear Regression & Comparison of 2 Regressions
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm working on taking a large amount of data stored in .csv, then performing some operations with it in MATLAB. It's been several years since I've used MATLAB, so I'm a bit rusty at it - luckily I've made some progress thanks for forums and examples.
Right now I've got plots that are being generated and show what I'm looking for, but I'm struggling to get the information off of them that I need. In essence, my test setup is a sealed vessel that I've got strain gauges on. The plots show pressure on the x-axis and strain on the y-axis; what they show is that there is plastic deformation after the maximum pressure, evident by the strain being different as the pressure is released versus that when pressure is raised. This is ASME BPVC.VIII.1-2021 UG-101[n] if anyone is curious.
I'm needing to generate a curve on the line as pressure is applied, then generate a second curve as pressure is released. I'm not really too sure how to approach that one, i.e. generate two curves on the same set of data but separated by a maximum pressure.
After I have the curves, I then need to compare the two curves to see how much variation there is between them in the form of percent change.
Here is the code I've got thus far, which is merely generating the subplot:
% Input table name from Workspace
dataset = SGTestingTrialIndex108100psi1;
% Parse out individual sensor columns to type DOUBLE
axial = table2array(dataset(: , 2));
maxAxial = max(axial);
circumferential = table2array(dataset(: , 4));
maxCircumferential = max(circumferential);
pressure = table2array(dataset(: , 6));
maxPressure = max(pressure);
% Plot axial values
subplot(2,1,1);
plot(pressure,axial);
xline(maxPressure);
yline(maxAxial);
title('Axial Strain Gauge');
xlabel('Pressure (psi_g)');
ylabel('Axial Strain');
hold on;
% Plot circumferential values
subplot(2,1,2);
plot(pressure,circumferential);
xline(maxPressure);
yline(maxCircumferential);
title('Circumferencial Strain Gauge');
xlabel('Pressure (psi_g)');
ylabel('Circumferential Strain');
And here is the plots that is being generated:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355038/image.png)
Any help or guidance is greatly appreciated!
댓글 수: 0
채택된 답변
Drew
2023년 4월 13일
You could separate the data into 4 parts:
Then, do regression on each part, and compare them. For the regression analysis, you could use the command line function fitlm, or use the Curve Fitter app, then export the fits to the command line.
댓글 수: 2
Drew
2023년 4월 13일
Since this answer helped you, please remember to "accept" the answer. I mention this because it looks like you are new to MATLAB answers.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!