Does anyone knows an Answer to this question?

1 回表示 (過去 30 日間)
John wick
John wick 2019 年 8 月 9 日
コメント済み: Neuropragmatist 2019 年 8 月 9 日
Mat Lab question.jpg
  3 件のコメント
Alex Mcaulley
Alex Mcaulley 2019 年 8 月 9 日
Just do it and you will take away the uncertainty
John wick
John wick 2019 年 8 月 9 日
Thank you so much ><

サインインしてコメントする。

採用された回答

Neuropragmatist
Neuropragmatist 2019 年 8 月 9 日
編集済み: Neuropragmatist 2019 年 8 月 9 日
Well let's think about it a little, in Matlab the multiplication sign (i.e. 5 x 5 = 25) is represented by an asterisk (*). Generally, if you have 2 numbers the asterisk will work the same as a multiplication:
5*5
ans = 25
However, when you have vectors or matrices this performs matrix multiplication which 99% of the time is probably not what you want unless you work with linear algebra, I can't really easily explain it here but you can read about it here. Instead you will probably want element-wise multiplication where each number in the matrix is multiplied by the corresponding number in the other matrix. To do that you have to put a full stop (.) before the asterisk to indicate that's what you want, like this:
[1 2 3 4].*[1 2 3 4]
ans = 1 4 9 16
Here each element of the left matrix has been multiplied by the element of the right matrix in the same position.
So let's look at your problem, the 1st answer will throw an error because the full stop is after the asterisk not before and Matlab doesn't know what to do with that. The 4th option is also not proper syntax (unless it is supposed to represent A*B which is the same as the 2nd option or [A B] which will not give anything like the answer).
So that leaves the 2nd and 3rd options, why don't you try them out in Matlab yourself, just run this code:
A = [0 6;3 5]
B = [7 6;9 3]
A*B
A.*B
But, if the second answer is correct you can easily work out in your head what it will look like, for instance the top right element of C would be the top right element of A (6) multiplied by the top right element of B (also 6)...
More generally, if you really need help with this homework you should probably read this:
Hope this helps,
M.
  2 件のコメント
Steven Lord
Steven Lord 2019 年 8 月 9 日
The 4th option is also not proper syntax
To nitpick slightly, it is a valid reference to a function named AB with no input arguments or a variable named AB so I wouldn't call it "not proper syntax". But since the problem statement doesn't mention either a function or variable by that name and there is no built-in MATLAB function named AB, I agree that this isn't the answer. It is there to trip people up if they assume MATLAB performs implicit multiplication.
Neuropragmatist
Neuropragmatist 2019 年 8 月 9 日
True, I could have been a bit clearer there.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by