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 Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by