How to raise a decimal numbers as power of A??
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello everyone..I am trying to raise decimal values which is ranging from(0.1:0.01:1) to the power of A(3x3 matrix).(eg.. A^[0.1:0.01:1]). I cannot find my answer anywhere.can anyone help me out..Thanks in advance..
댓글 수: 4
채택된 답변
Ameer Hamza
2020년 4월 8일
편집: Ameer Hamza
2020년 4월 8일
If you want to do the element-wise exponential operation, the following will work on R2016b and onward versions
B = A.^reshape((0:0.1:1),1,1,[]);
For matrix exponentiation
B = arrayfun(@(k) {A^k}, 0:0.1:1)
댓글 수: 4
추가 답변 (1개)
Stephen23
2020년 4월 8일
편집: Stephen23
2020년 4월 8일
Either use a loop or cellfun:
>> A = [1,5,3;4,5,9;7,8,9];
>> V = 0.1:0.11:10;
>> C = arrayfun(@(n)A^n,V,'uni',0);
And checking:
>> C{1} % 1st output
ans =
1.1085 0.27536 + 2.0123e-16i -0.12792 - 1.6129e-16i
-0.081108 - 2.2204e-16i 1.11 + 2.7756e-17i 0.2149 + 6.793e-17i
0.20384 - 1.0408e-17i 0.023577 + 2.2551e-17i 1.2353 - 1.3849e-17i
>> C{2} % 2nd output
ans =
1.1854 0.64417 + 9.7145e-17i -0.25035 - 7.7865e-17i
-0.13946 1.2253 + 2.7756e-17i 0.54956 - 2.2247e-17i
0.50717 - 2.7756e-17i 0.12473 + 1.0408e-17i 1.5344 + 2.9295e-18i
>> C{3} % 3rd output
ans =
1.2109 - 2.2204e-16i 1.0774 + 1.1102e-16i -0.32664 + 1.1886e-18i
-0.13857 - 2.2204e-16i 1.3464 + 5.5511e-17i 1.0074 + 4.5683e-17i
0.90535 0.33962 + 1.3878e-16i 1.8931 - 1.1124e-16i
etc.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!