Info
此问题已关闭。 请重新打开它进行编辑或回答。
matlab matrices
1 次查看(过去 30 天)
显示 更早的评论
Guys what is matlab doing in these three situations? If the vector Data equals:
Data =
1.4000 2.9000 4.8000 6.7000 8.9000
Then in this situation: x = (exp(a*2*pi)-cosh(a*b*Data(1)))./sinh(a*b*Data(1))
I understand it is using the first entry of the vector data, and therefore just doing the sum but in this situation:
x = (exp(a*2*pi)-cosh(a*b*Data))/sinh(a*b*Data)
I also just displays one value (0.99999) for x even though Data is a Vector,
then in this situation: x = (exp(a*2*pi)-cosh(a*b*Data))./sinh(a*b*Data)
x is now a vector because of the matrices operator. What i want to know is what is going on behind the . operator. i am trying to calculate this same equation in C programming, but I am not sure what is going on different between having the dot and not having the dot. I know the second scenario is doing something with all the Data values but I dont know what
0 个评论
回答(1 个)
Paulo Silva
2011-8-12
with the dot the operations are done element by element, example with multiplication:
[1 2 3].*[4 5 6]=[1*4 2*5 3*6]
without the dot you must do the math with the vector
[1 2 3]*[4 5 6] it's not possible because the size of the second vector, when doing operations without the dot the number of columns of the first vector must be equal to the number of rows of the second
[1 2 3]*[4 5 6]' transposing the second vector and you can now do it, the result is just one value because of the sizes -> 1x3 * 3x1 = 1*1
[1 2 3]*[4 5 6]'=1*4+2*5+3*6=32
2 个评论
Paulo Silva
2011-8-12
Data=[1.4000 2.9000 4.8000 6.7000 8.9000]
a=1;b=1;
v1=(exp(a*2*pi)-cosh(a*b*Data));
v2=sinh(a*b*Data);
x = (exp(a*2*pi)-cosh(a*b*Data))/sinh(a*b*Data)
x1=v1*(v2/norm(v2)^2)' %Inverse Vector using Geometric Multiplication
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!