-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab4.m
58 lines (42 loc) · 789 Bytes
/
lab4.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
56
57
58
% Michael Korzon
% Scientific Computing
% Dr. Szczurek
% Lab 4
%% Problem 1
% 1-1
person1 = struct();
person1.name = 'Michael';
person1.rank = 5;
person1.serial_number = 'a54d1921';
disp(person1);
% 1-2
person2 = struct('name', 'Michael',
'rank', 5,
'serial_number', 'a54d1921');
disp(person2);
% 1-3
person2.serial_number = char(person2.serial_number + '1');
disp(person2.serial_number);
%% Problem 2
% 2-a
cells = {{exp(1), 'Exponential'},
{rand(3), @(t) log(cos(t) + 1)}};
% 2-b
product = cells{1}{2} * cells{1}{1};
disp(product)
% 2-c
a = cells{2}{2}(pi/2);
disp(a)
%% Part 3
% 1-a
f = @(x, y) sin(x+y) .* cos(x-y);
% 1-b
g = @(x) f(x, 1);
% 1-c
limits = [-5 5];
fplot(g, limits);
%% Part 4
% 1-a
zebra = 'ZEBRA';
% 1-b
zebra = char(mod(zebra+3-65, 26) + 65)