-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_polarplot.m
55 lines (48 loc) · 1.24 KB
/
test_polarplot.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
close all
clear all
clc
% % make a rectangular grid of r and theta,
% % then define x and y in the usual way
% rr = 0:1:20;
% thth = (0:.05:1)*2*pi;
% [r th] = meshgrid(rr,thth);
% x = r.*cos(th);
% y = r.*sin(th);
% z = 1 + x.^2 - y.^2;
% surf(x,y,z)
% view(2)
%
% % set(c_bfm,'LineStyle','none');
% hold on
% plot([zeros(1,13); 90*cosd(0:30:360)], [zeros(1,13); 90*sind(0:30:360)],'k')
% plot(90*((0:0.33:1)'*cosd(0:10:360))', 90*((0:0.33:1)'*sind(0:10:360))','k')
% colorbar
% set(colorbar,'FontSize',16)
% axis equal
% set(gca, 'Box','off', 'XColor','none', 'YColor','none', 'Color','none')
% hold off
%
% xt = 105*cosd(0:30:330);
% yt = 105*sind(0:30:330);
% tlbls = sprintfc('%3d°', (0:30:330));
% text(xt, yt, tlbls)
% Definisikan jari-jari dan sudut
r = linspace(0, 2, 20);
theta = linspace(0, 2*pi, 91);
% Buat matriks jari-jari dan sudut
[R, THETA] = meshgrid(r, theta);
% Hitung koordinat kartesian
x = R .* cos(THETA);
y = R .* sin(THETA);
% Definisikan fungsi z
z = R .* sin(2*THETA);
% Buat plot polar mesh
surf(x, y, z,'EdgeColor', 'none');
xlabel('x');
ylabel('y');
zlabel('z');
title('Plot Polar Mesh');
view(2)
% Tambahkan label untuk radius dan sudut
text(1.5, 0, 2, 'Radius', 'FontSize', 12);
text(0, 1.5, 2, 'Sudut', 'FontSize', 12);