clear; close all;
% imie nazwisko indeks
% Grupa nr. 1, Wtorek, 7:30
% LAB 01
A = [1 2;
3 4];
B = [6 7;
8 9];
zad_1a = A*B;
zad_1b = A.*B;
% ops -> Operators and special characters.
zad_2_ops_1 = plus(2, 2); % +
zad_2_ops_2 = eq(2, 2); % ==
% elfun -> Elementary math functions
zad_2_elfun = log10(10000);
% elmat -> Elementary matrices and matrix manipulation
zad_2_elmat = ones(3,3);
% strfun -> Character arrays and strings
zad_2_strfun = double(B);
%======================================================
figure; % creates a new figure window
x = -10:1:10;
a = -2:.5:2;
%kolor='rgbcrgbcrgbcrgbc';
kolor='rgbc';
title("Wykres lab01 a * x^2");
xlabel("Wartość x");
ylabel("Wartosć a");
lista=["co "; "kto "; "gdzie"];
opis = lista(1,:);
for i = 1 : length(a)
%plot(x, a(i)*x.*x, ['-.', kolor(i)]);
plot(x, a(i)*x.*x, ['-.', kolor(mod(i,4)+1)]);
hold on;
grid on;
% punkt = sprintf("ax^2=%s", num2str(a(i)*x.*x));
% text(x, a(i)*x.*x, punkt);
% axx = a(i)*x.*x;
% text(x, axx, ['ax^2=', num2str(axx)]);
for te = [-10:1:10] %Nie da się bez pętli
text(te, a(i)*te.*te, ['ax^2=', num2str(a(i)*te.*te)])
end
opis(i,:)=sprintf('(%s) a=%3d',kolor(mod(i,4)+1) , a(i));
end
legend(opis, 'Location', 'northwestoutside');
%======================================================