Plotting functions using subplot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi I hope you can help.
How do I plot funtions like this (see below) While using subplot?
f(x) = 3 sin2 (x) + cos(x/2), x ∈ [−3, 6.5]
g(x, y) = x 4 − 8y 2 + x + 4, x, y ∈ [−5, 5]
r(φ) = 2 + cos(5φ), φ ∈ [0, 2π]
Thank you!
Réponses (1)
Image Analyst
le 9 Sep 2023
% f(x) = 3 sin2 (x) + cos(x/2), x ∈ [−3, 6.5]
% g(x, y) = x 4 − 8y 2 + x + 4, x, y ∈ [−5, 5]
% r(φ) = 2 + cos(5φ), φ ∈ [0, 2π]
subplot(3, 1, 1);
x = linspace(-3, 6.5, 1000);
f = 3 * sin(x) .^ 2 + cos(x/2);
plot(x, f, 'r-', 'LineWidth', 2);
grid on;
xlabel('x')
ylabel('y')
subplot(3, 1, 3);
phi = linspace(-5, 5, 1000);
r = 2 + cos(5 * phi);
plot(phi, r, 'r-', 'LineWidth', 2);
grid on;
xlabel('phi')
ylabel('r')
To learn other fundamental concepts, invest 2 hours of your time here:
0 commentaires
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!