Info
此问题已关闭。 请重新打开它进行编辑或回答。
could anyone help me to solve the error
2 次查看(过去 30 天)
显示 更早的评论
Bmax=20;
noise=10;
A= [2 3 0 0 5;
5 6 0 0 4;
1 9 0 0 3]
B = [1 5 0 0 6;
4 3 0 0 2;
7 8 0 0 9]
G=sort(A,'descend')
P=sort(B)
syms k
for k=1:size(G,1)
throughput =(Bmax.*log2(1+(((P).*(G))./(noise+(symsum(P,1:k-1).*G)))))
end
If i am running the code i am getting
Error in (line 16)
throughput =(Bmax.*log2(1+(((V).*(U))./(noise+(symsum(U,1,k-1).*V)))))
Undefined function 'symsum' for input arguments
of type 'double'.
0 个评论
回答(1 个)
Walter Roberson
2018-1-16
Your error message has symsum of U but your code has symsum of P .
Your array P is the result of the sort(B) and since B is numeric, your P is numeric. You cannot symsum() a numeric array. Even if you could, your syntax symsum(P,1:k-1) would only be a valid syntax if k just happened to be 3, in which case 1:k-1 would be 1:2 and you would accidentally encounter the abbreviated syntax symsum(f,AB) meaning the same as symsum(f, symvar(f), AB(1), AB(2))
Your error message has symsum(U,1,k-1) which would be symsum(U, symvar(U), 1, k-1) which would be valid if U happened to be a symbolic expression. Unfortunately, U is not defined in your code.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!