How can I plot this two figures?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Respuesta aceptada
Image Analyst
el 27 de Oct. de 2018
Try this:
w = 1;
a = 1;
r = linspace(0, 3, 500);
vth = w .* r;
% Get indexes where r is more than 1.
mask = r > 1;
% Do second (right) part of the equation.
vth(mask) = (w*a^2) ./ r(mask);
subplot(1, 2, 1);
plot(r, vth)
axis equal
xlim([0, 3]);
ylim([0, 2]);
% Plot dashed vertical line
hold on;
line([a, a], ylim, 'LineStyle', '--', 'Color', 'k', 'LineWidth', 2);
xlabel('r', 'FontSize', 20);
ylabel('u', 'FontSize', 20);
subplot(1, 2, 2);
plot([0, a], [2, 2], 'k-', 'LineWidth', 2);
xlim([0, 3]);
ylim([0, 3]);
% grid on;
xlabel('r', 'FontSize', 20);
ylabel('w', 'FontSize', 20);
% Plot dashed vertical line
hold on;
line([a, a], ylim, 'LineStyle', '--', 'Color', 'k', 'LineWidth', 2);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192943/image.png)
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!