Borrar filtros
Borrar filtros

Plotting a 3-value graph

15 visualizaciones (últimos 30 días)
rahan sof
rahan sof el 7 de Abr. de 2024
Respondida: Avni Agrawal el 28 de Jun. de 2024 a las 6:00
Hı,
How can I draw the graph whose image I added? can you help me please?
The relationship between values is briefly,
drift ratio - displacement
displacement - base shear
I use the hold on command, but displacement and drift ratio are on the same axis (x axis).
How can I define separate axis like here?
  9 comentarios
Mann Baidi
Mann Baidi el 7 de Abr. de 2024
I'm not sure about the requirement but you can define the relation bewteen them using the equation.
x2=(relation with x)*x;
Hope this will help!
rahan sof
rahan sof el 7 de Abr. de 2024
Unfortunately it didn't work but thank you very much.

Iniciar sesión para comentar.

Respuestas (1)

Avni Agrawal
Avni Agrawal el 28 de Jun. de 2024 a las 6:00
Hi,
I understand that trying to plot two different y-axes for the same x-axis in MATLAB, you can use the yyaxis function. This allows you to create a plot with two y-axes, one on the left and one on the right, each with its own scale.
Here ia an example of how you can plot the relationship between drift ratio and displacement on one y-axis, and displacement and base shear on the other y-axis:
% Sample data
displacement = 0:0.1:10; % Example displacement data
drift_ratio = displacement * 0.05; % Example drift ratio data
base_shear = displacement * 2; % Example base shear data
% Create figure
figure;
% Plot drift ratio vs. displacement on the left y-axis
yyaxis left;
plot(displacement, drift_ratio, '-b', 'LineWidth', 1.5);
ylabel('Drift Ratio');
xlabel('Displacement');
hold on;
% Plot base shear vs. displacement on the right y-axis
yyaxis right;
plot(displacement, base_shear, '-r', 'LineWidth', 1.5);
ylabel('Base Shear');
% Add title and legend
title('Displacement vs. Drift Ratio and Base Shear');
legend('Drift Ratio', 'Base Shear');
% Adjust figure properties
grid on;
I hope this helps!

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by