I have no idea how to add dots to this equations. ab is matrix, er1 and er2 are variables. Please help me :3 CODE:
ab=(0.01:0.01:10);
er1=2.05;
er2=4;
Z01=60*log(ab)*sqrt((log(0.5*ab)+log(0.5))/log(ab));
Z02=60*log(ab)*sqrt((er1*log(0.5*ab)+log(0.5))/(er1*log(ab)));
Z03=60*log(ab)*sqrt((er2*log(0.5*ab)+log(0.5))/(er2*log(ab)));

 採用された回答

Star Strider
Star Strider 2016 年 1 月 2 日

1 投票

I assume you intend ‘add dots’ to create element-wise operators:
ab=(0.01:0.01:10);
er1=2.05;
er2=4;
Z01=60*log(ab).*sqrt((log(0.5*ab)+log(0.5))./log(ab));
Z02=60*log(ab).*sqrt((er1*log(0.5*ab)+log(0.5))./(er1*log(ab)));
Z03=60*log(ab).*sqrt((er2*log(0.5*ab)+log(0.5))./(er2*log(ab)));
Here I substituted ‘.*’ for ‘*’ and ‘./’ for ‘/’, that I assume is what you want to do. See the documentation for Array vs. Matrix Operations for details.

その他の回答 (2 件)

dpb
dpb 2016 年 1 月 2 日

1 投票

Everywhere there's an arithmetic operator (other than + or - which are born doing the right thing :) ) replace the operator with it's "dot" doppelganger twin -- '*' --> '.*', etc. when you want/expect operations on an element-by-element basis. Otherwise for vectors or matrices, those operations have equivalent meanings as matrix multiply, etc.
It's not the simplest thing to find in the doc's; the search engine fails for ".*" as a string; you needs must know that the name is [m]times for the functions, not "mult" or some variation thereof. The best discussion is from the Language Fundamentals/Operators and Elementary Operations/Operators.
Arcadius Unknown
Arcadius Unknown 2016 年 1 月 2 日

0 投票

Thanks for all the replies, it worked :)

2 件のコメント

dpb
dpb 2016 年 1 月 2 日
So "ACCEPT" an answer....
Image Analyst
Image Analyst 2016 年 1 月 2 日
And you can also vote for one or both. It's the polite thing to do to give the people who took the time to help you "credit" for their efforts.

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

カテゴリ

ヘルプ センター および File ExchangeParallel Computing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by