Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HELP!!!! I am in need of help on my homework, I am given two matrices A and B wh

ID: 668354 • Letter: H

Question

HELP!!!!

I am in need of help on my homework, I am given two matrices A and B which our professor allowed us to download and "load inputs;" it into our matlab, but I am seeing how to solve these questions:

1.) Consider two matrices ‘A’ of size 350 x 450 and ‘B’ of size 450 x 500. Calculate the matrix, ‘C’, which is the product of ‘A’ and ‘B’ by: Using ‘for’ loops to calculate the elements of the matrix ‘C’!!!!!!!!!!!!!!!!!!!

2.)

Write a MATLAB code to check whether the entered date is valid or not. You can provide your own inputs. Create your own .m file and save the code in it (Hints: use ‘strsplit’ MATLAB command to split the given date into ‘month’, ’day’, ’year’ and ‘str2double’ MATLAB command to convert it into a double)

Date Format: MM/DD/YYYY

Example 1:

         Input: 01/01/1999

         Output: valid date

Example 2:

         Input: 15/15/2015

         Output: Date not valid

PLEASE SOMEBODY HELP ME SOON!

Explanation / Answer

1. Matrix multliplication can be done directly with a * operator. As you are reading input matrices into A and B, the simple and straight forward way to perform matrix multiplication is C = A * B.

As specified by you, the input matrix A is of size 350 x 450, and input matrix B is of size 450 x 500, therefore the output matrix C is of size: 350 x 500.

As you want to use for loops, the codes goes like this:

2. Date Validation code for matlab:

date= input('Enter the date string: ');

array = strsplit(date,'/');

day = array{1};

month = array{2};

year = array{3};

dd= str2double(day);

mm= str2double(month);

yyyy= str2double(year);

if(mm < 12)

if(mm == 1 && dd <= 31)

disp('valid date');

else if(mm == 2 && dd <= 29 )

   disp('valid date');

   else if(mm == 3 && dd <= 31)

   disp('valid date');

   else if(mm == 4 && dd <= 30)

   disp('valid date');

   else if(mm == 5 && dd <= 31)

   disp('valid date');

   else if(mm == 6 && dd <= 30)

   disp('valid date');

   else if(mm == 7 && dd <=31)

   disp('valid date');

   else if(mm == 8 && dd <= 31)

   disp('valid date');

   else if(mm == 9 && dd <= 30)

   disp('valid date');

   else if(mm == 10 && dd <= 31)

   disp('valid date');

   else if(mm == 11 && dd <= 30)

   disp('valid date');

   else if(mm == 12 && dd <= 31)

   disp('valid date');

   else

   disp('Date not valid');

   end

   end

   end

   end

   end

   end

   end

   end

   end

   end

   end

end

else

disp('Date not valid');

end;