Is there a way to shift the data upwards automatically?

2 visualizzazioni (ultimi 30 giorni)
Hi folks,
I have a graph as follows. I am looking to shift the valley (red) upwards to be in keeping with the preceeding data. Is there a way to do this automatically? I am unaware of the best method of achieving this currently.
I've attached a copy of the data for reference.
  4 Commenti
the cyclist
the cyclist il 14 Giu 2021
Also, you might want to upload one example of the data, so people can try out solutions on real data.

Accedi per commentare.

Risposta accettata

the cyclist
the cyclist il 14 Giu 2021
Modificato: the cyclist il 14 Giu 2021
I tried plotting Height vs. Temperature, since that is what your plot shows. But my graph looks completely different from yours.
r = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/652735/Results.xls','Sheet','Test Piece 1-BS 1');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
figure
plot(r.Temperature,r.Height,'.')
Perhaps make it easier for us to help you, by only uploading the two variables you are plotting above, in a MAT file?
EDIT (in response to comment):
I've uploaded the new data file. Also, this whole thing should have been a comment rather than an answer. But I'll leave it here.
  8 Commenti
Teshan Rezel
Teshan Rezel il 14 Giu 2021
thanks @the cyclist, I think I've gotten this far and used gaussian smoothening to get it looking a bit better. However, isolating where this valley occurs automatically is proving tricky and that's what I really need help with. I've tried to look at the max gradient and average gradient but to no avail...
the cyclist
the cyclist il 14 Giu 2021
The key is get a firm conceptual understanding of what defines the valley. In your original image, it looked simple, because it looked like a huge drop from one data point to the very next one. But in the dataset you uploaded that I plotted, it is not as clear.
So, before you think about how to code it, you need to make this conceptual understand that works in general for your datasets. Then I would recommend writing pseudocode for the actual algorithm steps, and then the actual MATLAB code. We can mostly be helpful in that last step.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Descriptive Statistics in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by