Regression plot help for a range of data
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Liam O'Brien
am 4 Jul. 2021
Kommentiert: dpb
am 5 Jul. 2021
Hello, I am currently tasked with creating a regression plot in matlab using for loops, but I have never done it before and don't know how. I have tried looking it up a number of different ways, but none of these ways seem to be similar to what I have to do.
The equation that I have is k = ((L*u*Q)/(dp*A)), where k is permeability, Q is flux, and dp is the change in pressure. All of the other variables are constant.
How would I go about making a regression plot for k, or permeability, for a range of different flux values and/or pressure values. If I can do them both at the same time that is cool, but if it needs to be done one at a time that would work too. Currently I am trying to do 0.0001-0.001 for flux in steps of 0.0001, and pressure 1 to 1000 newtons in steps of 15 or so. The steps are not that important, but getting started is the most important part. If anyone has any advice/links that they think would help it would be greatly appreciated.
1 Kommentar
dpb
am 4 Jul. 2021
Another use for meshgrid and surf() it would seem. IA just answered one a little while ago while I just pointed the OP to the documentation :) ...
Just substitute your function and range of independent variables, any away you go...
Akzeptierte Antwort
Sulaymon Eshkabilov
am 4 Jul. 2021
No need to employ meshgrid() for calculations instead, use color ":" operator that performs vectorized calcs.
L=...;
u=...;
A=...;
Q=0:.0001:.001; % Flux
dp=1:15:1000; % Change in pressure
k = ((L*u*Q)./(dp(:)*A));
surf(k)
5 Kommentare
dpb
am 5 Jul. 2021
All you need/want for a linear plot like the above is plot()
Just set hold on after the first line is drawn to add to it.
Or, create an array of the YData as columns for each of the second variable and pass it; plot treats each column of a 2D array as a separate line automagically.
See the documentation for plot for example usage.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Two y-axis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!