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

 Respuesta aceptada

Star Strider
Star Strider el 2 de En. de 2016

1 voto

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.

Más respuestas (2)

dpb
dpb el 2 de En. de 2016

1 voto

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 el 2 de En. de 2016

0 votos

Thanks for all the replies, it worked :)

2 comentarios

dpb
dpb el 2 de En. de 2016
So "ACCEPT" an answer....
Image Analyst
Image Analyst el 2 de En. de 2016
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Parallel Computing Toolbox en Centro de ayuda y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by