0% found this document useful (0 votes)
14 views2 pages

Amee Formate

Uploaded by

kandarpppp1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Amee Formate

Uploaded by

kandarpppp1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Date:

Name:

Enrolment No.

Pract. No.:

Code:
disp('Welcome to Sci Lab!');
// Mathematical Operations
result_addition = 5 + 3;
result_subtraction = 10 - 4;
result_multiplication = 2 * 6;
result_division = 15 / 3;
// Numerical value is converted in string
disp(['Addition: ' string(result_addition)]);
disp(['Subtraction: ' string(result_subtraction)]);
disp(['Multiplication: ' string(result_multiplication)]);
disp(['Division: ' string(result_division)]);
// variables
variable_a = 18;
variable_b = 14;
sum_of_variables = variable_a + variable_b;
disp(['sum_of_variable: ' string(sum_of_variables)]);
// mathfunctions
sqrt_result = sqrt(9);
sin_result = sin(30);
disp(['sqrt_result: ' string(sqrt_result)]);
disp(['sin_result: ' string(sin_result)]);
//generate 2D graph
x = 0:0.1:10;
y = sin(x);
plot(x, y);
xlabel('X-axis');
ylabel('Y-axis');
title('Simple 2D Graph');
y2 = cos(x);
mtlb_hold on;
plot(x, y2, 'r--');
mtlb_hold on;
legend('sin(x)', 'cos(x)');
//matrix operations
matrix_a = [1, 2; 3, 4];
matrix_b = [5, 6; 7, 8];
sum_of_matrices = matrix_a + matrix_b;
product_of_matrices = matrix_a * matrix_b;
disp('Matrix A:');
disp(matrix_a);
disp('Matrix B:');
disp(matrix_b);
disp('Sum of Matrices:');
disp(sum_of_matrices);
disp('Product of Matrices:');
disp(product_of_matrices);
Result:

"Subtraction: " "6"

"Multiplication: " "12"

"Division: " "5"

"sum_of_variable: " "32"

"sqrt_result: " "3"

"sin_result: " "-0.9880316"

"Matrix A:"

1. 2.
3. 4.

"Matrix B:"

5. 6.
7. 8.

"Sum of Matrices:"

6. 8.
10. 12.

"Product of Matrices:"

19. 22.
43. 50.

Waveforms:

You might also like