Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Creating an area graph with known variables on the x and y-axis

1 visualizzazione (ultimi 30 giorni)
I am trying to create an elevation graph using contour lines and a straight line cutting through the contour lines. Contour lines need an x,y,z coordinate points. I want to create an elevation graph with the x values from the line (representing distance on the x-axis), and the z values (representing elevation on the y-axis). I want it to be a regular graph with a solid line representing the values and no incremented straight lines.
The 'xvalues' of the line is an array. I tried making it a column array by doing xvalues' or xvalues = (0.0000:0.1000:3.0000)';to a variable, yet the variable wouldn't create (??? May have to close everything and open matlab again).
Xvalues on the x-axis as the distance and I have the z values on the y-axis. 'corresponding_z" is a column array. I did "(1:size(xvalues), : )" to get the rows in that 1 column that correspond to the size of the xvalues array. For example, xvalues is a row-array with 31 elements. I want the same corresponding z values within the column-array "corresponding_z". I don't really know if this is correct.
plot(xvalues,corresponding_z(1:size(xvalues),:))
When I call plot, I get an empty graph.
xvalues = (0.0000:0.1000:3.0000);
if ismembertol(x,xvalues)
xln = [0.0000 3.0000]; %from before
xvalues = (0.0000:0.1000:3.0000); %xvalues of straight line with 0.1 increment
%rows and columns where the xvalues of the line are the values in x(contour lines)
idx = find(ismembertol(x,xvalues));
corresponding_y = y(idx);
corresponding_z = z(idx);
corresponding_x = x(idx);
hold on
figure
plot(xvalues,corresponding_z(1:size(xvalues),:))
xlabel('Distance')
ylabel('Elevation')

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by