difference between e lines of codes

1 回表示 (過去 30 日間)
kay Dee
kay Dee 2018 年 10 月 7 日
編集済み: Stephen23 2018 年 10 月 7 日
Hello i am trying out a code and i would love to ask the difference between these 2 lines of code H=(g/(1+g))./(1+t*s/(1+g));(where there is a ./) and H=(g/(1+g))/(1+t*s/(1+g));(where there is no ./ sign ) P.s. the second one shows me an error also where should i use that ./ sign and where i shouldnt use it ? thanks very much
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 10 月 7 日
Look at the documentation for the two functions
rdivide
mrdivide
madhan ravi
madhan ravi 2018 年 10 月 7 日
Also look at element wise operations

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

回答 (1 件)

Stephen23
Stephen23 2018 年 10 月 7 日
編集済み: Stephen23 2018 年 10 月 7 日
"...should i use that ./ sign and where i shouldnt use it?"
You pick the operation based on what operator you need to use. If you need to perform element-wise division, then use ./, but if you need to perform least squares of a system of equations, use /.
Knowing the difference between matrix operations and element-wise operations is critical for being able to use MATLAB properly: not just division, but multiplication, transpose, and power too. You need to read the MATLAB documentation:
In a nutshell, the commands with the period . perform array operations (i.e. element-wise), whereas those without perform matrix operations (i.e. linear algebra). Read the help for each specific operation to know what it does.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by