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)));

 Accepted Answer

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.

More Answers (2)

dpb
dpb on 2 Jan 2016
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 on 2 Jan 2016
Thanks for all the replies, it worked :)

2 Comments

So "ACCEPT" an answer....
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.

Sign in to comment.

Categories

Find more on Parallel Computing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!