Plotting points that pass through y for x,y,z coordinates

2 Ansichten (letzte 30 Tage)
jacob Mitch am 24 Nov. 2019
Kommentiert: Stephan am 25 Nov. 2019
I have a Data file of 3 rows 20 columns with the first row being x, second being y, third being z
Data=[0.345 0.343 0.341 0.339 0.337 %sample x data
-0.005 -0.002 -0.00069 0.0015 0.0034 %sample y data
0.284 0.284 0.284 0.284 0.284] %sample z data
I am able to plot the data in the x,z cordinates using
plot(Data(1,:),Data(3,:));
My question is how would I find and plot point that pass through y=0, on this graph say in red circles. I am a bit unsure since the plot is in x,z coordinates and I do not have a strict y=0 value in my data. Any help would be really appreciated.
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Stephan am 24 Nov. 2019
Data=[0.345 0.343 0.341 0.339 0.337 %sample x data
-0.005 -0.002 -0.00069 0.0015 0.0034 %sample y data
0.284 0.284 0.284 0.284 0.284] %sample z data
plot(Data(1,:),Data(3,:));
x0 = interp1(Data(2,:),Data(1,:),0)
z0 = interp1(Data(2,:),Data(3,:),0)
hold on
scatter(x0,z0,'or')
hold off
2 KommentareKeine anzeigenKeine ausblenden
jacob Mitch am 24 Nov. 2019
Stephan, thank you so much this helps me understand a lot better, is it possible to do with more with a larger Data set, say y has multiple passes through 0.
Stephan am 25 Nov. 2019
I dont think that interp1 would be suitable for this. But you could write your own function to do so. All you need to do is find all the pairs where the sign changes in your data and the corresponding values to them. Then perform a linear calculation on this pairs to find the values you're looking for.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Annotations 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!

Translated by