Plotting functions using subplot
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
Antworten (1)
Image Analyst
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!