Plotting functions using subplot
3 views (last 30 days)
Show older comments
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!
Answers (1)
Image Analyst
on 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 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!