instagram twitter linkedin github youtube

9.1.18

MATLAB grafik çizdirme

Subplot fonksiyonu sayesinde matlabda birden fazla grafiği aynı anda ekrana çizdirebiliriz.

c=cos(x*pi/180); %Matlabda trigonometrik işmelemler radian cinsinden yapılır
s=sin(x*pi/180); %Matlabda trigonometrik işmelemler radian cinsinden yapılır
subplot(1,2,1), plot(x,c);
xlabel('x');
ylabel('cos(x)');
title('0 - 360 derece arası kosinus');
subplot(1,2,2), plot(x,s);
xlabel('x');
ylabel('sin(x)');
title('0 - 360 derece arası sinus');


yada

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
derece=[0:1:360];
c=cos(derece*pi/180); %Matlabda trigonometrik işmelemler radian cinsinden yapılır
s=sin(derece*pi/180); %Matlabda trigonometrik işmelemler radian cinsinden yapılır
 
derece2=-5*pi:.1:5*pi;
snc=sinc(derece2);
 
x=[-3:1:5];
y=sqrt((x.^2+7)/3);
 
subplot(2,2,1), plot(derece,c);
xlabel('derece');
ylabel('cos');
title('0 - 360 derece arası kosinus');
subplot(2,2,2), plot(derece,s);
xlabel('derece');
ylabel('sin');
title('0 - 360 derece arası sinus');
subplot(2,2,3), plot(derece2,snc);
xlabel('derece');
ylabel('sinc');
title('-5 pi - 5 piderece arası sinc');
subplot(2,2,4), plot(x,y);
xlabel('x');
ylabel('y');
title('sqrt((x.^2+7)/3)');