Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Macierz m na n z jedynkami i ciąg fibbanaciego
- function[A] = f2(m,n)
- A = ones(m,n);
- for i = 3:m*n
- A(i) = A(i-1)+A(i-2);
- end
- end
- %Jeżeli x to
- function zad2(x)
- if x<0
- x=x^2-5
- elseif x==0
- x=0
- elseif x>0
- x=-x^3+7
- end
- %Rysuje funkcję dla powyższego x
- x1=[-20,0];
- x2=0;
- x3=[0,10];
- plot(x1,x1.^2-5,x2,0,x3,x3.^3+7);
- %kolorowanie obrazu
- A=imread('obraz.jpg');
- A(1:end,1:20,2)=0;
- A(1:end,1:20,3)=0;
- A(1:20,21:end,2)=0;
- A(1:20,21:end,3)=0;
- A(21:end,370:end,2)=0;
- A(21:end,370:end,3)=0;
- A(370:end,21:369,2)=0
- A(370:end,21:129,3)=0;
- image(A)
- %negatyw obrazu
- A = imread('obraz.jpg');
- B = 255-A;
- C = A(30:end-30,30:end-30,:);
- B(30:end-30,30:end-30,:) = C;
- image(B);
- %Zad 4 rysowanie wykresow
- Um=325
- t=[0:0.001:50]
- w1=2*pi*50;
- U1=Um*sin(w1*t/1000);
- U2=Um*sin(2*pi/3+w1*t/1000);
- U3=Um*sin(4*pi/3+w1*t/1000);
- w31=2*pi*50*3
- w32=2*pi*50*5
- w33=2*pi*50*7
- U31=Um*sin(w31*t/1000);
- U32=Um*sin(2*pi/3+w32*t/1000);
- U33=Um*sin(4*pi/3+w33*t/1000);
- U41=U1+U31;
- U42=U2+U32;
- U43=U3+U31;
- Um1=U1-U2;
- Um2=U2-U3;
- Um3=U3-U1;
- ax1=subplot(4,1,1);
- ax2=subplot(4,1,2);
- ax3=subplot(4,1,3);
- ax4=subplot(4,1,4);
- plot(ax1,t,U1,'b-',t,U2,'k-',t,U3,'r-');
- plot(ax2,t,Um1,t,Um2,t,Um3);
- plot(ax3,t,U31,t,U32,t,U33);
- plot(ax4,t,U41,t,U42,t,U43);
- %Rysowanie wykresów dokumentacja
- % Create data and 2-by-1 tiled chart layout
- x = linspace(0,3);
- y1 = sin(5*x);
- y2 = sin(15*x);
- tiledlayout(2,1)
- % Top plot
- ax1 = nexttile;
- plot(ax1,x,y1)
- title(ax1,'Top Plot')
- ylabel(ax1,'sin(5x)')
- % Bottom plot
- ax2 = nexttile;
- plot(ax2,x,y2)
- title(ax2,'Bottom Plot')
- ylabel(ax2,'sin(15x)')
- %zad5
- ******Funkcja******
- function[y] = f1(f,x)
- y = 0;
- for i = 2:length(x)
- y = y + ( (f(i)+f(i-1))*(x(i)-x(i-1)))/2;
- end
- end
- ******Skrypt********
- x1 = [0:0.0001:10];
- x2 = [0:0.0001:2*pi];
- y1 = 3*x1+10;
- y2 = sin(x2);
- y3 = x1.^2-3*x1+1;
- a = f1(y1,x1);
- b = f1(y2,x2);
- c = f1(y3,x1);
- a
- b
- c
- %zad5 inne
- syms x
- y=3*x^4+x^3+7*x^2+4
- dx=diff(y)
- dxx=diff(dx)
- i=int(y)
- fplot(y)
- hold on
- fplot(dx)
- fplot(dxx)
- fplot(i)
- legend("Funkcja pierwotna", "Pochodna pierwszego rzedu", "Pochodna drugiego rzedu", "Calka z y",'location','SouthEast')
- grid('on')
- grid('minor')
- title("Wykres zad5")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement