Remove nonsensical data in plot (for loop )

I am plotting my results from thermodynamic cycle analysis using a for loop. However, some curves have non-sensical data and I would like to remove them. The X-data is fixed, but the loction of where the Y-data become non-sensical varies. Is there a solution to this particular issue?

4 Kommentare

Torsten
Torsten am 4 Okt. 2025
If you define a mathematical criterion for what "non-sensical" is, you can sort out these data.
Walter Roberson
Walter Roberson am 4 Okt. 2025
What do you want to have happen? Automatic detection of lines that have singularities and just not plot those lines at all? Automatic detection of lines that have singularities and some kind of automatic straightening of those lines so that they no longer have singularities? Automatic detection of lines that have singularities acting as feedback to the process to know to redo the calculations somehow?
Sara
Sara am 4 Okt. 2025
For example in the attached ECOPNET_3.png is the intended result. The vertical lines in ECOPNET_2.png is what needs to be removed.
dpb
dpb am 4 Okt. 2025
How are the results being generated; why not fix that proceess to not create the discontinuities to begin with?
If nothing else, at least attach .mat files containing the data such that somebody can do something with it; nothing can be done with the images except look at them.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 5 Okt. 2025

0 Stimmen

%assume that Data_To_plot is an N x 7 array of data to be plotted
Copy_Data = Data_To_plot;
Copy_Data(~cumprod(Data_To_Plot > 0, 1)) = nan;
plot(x, Copy_Data)

Produkte

Version

R2018b

Gefragt:

am 4 Okt. 2025

Beantwortet:

am 5 Okt. 2025

Community Treasure Hunt

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

Start Hunting!

Translated by