could anyone help me to solve the issue for the following code:

1 次查看(过去 30 天)
code:
C=100;
A=10;
B=40;
A=20;
B=30;
A=30;
B=20;
A=50;
B=10;
A=60;
B=45;
D =(C.*log2(1+(A)*(B)))
for the above code i want to calculate D with respect to all A and B.But when i run the code it is considering only A=60 and B=45.Could anyone help me how to calculate D with respect to all A and B from the beginning
A=10;
B=40;
A=20;
B=30;
A=30;
B=20;
A=50;
B=10;

采纳的回答

KSSV
KSSV 2018-4-12
A=[ 10 20 30 50];
B=[40 30 20 10] ;
D = zeros(size(A)) ;
for i = 1:length(A)
D(i) =C.*log2(1+A(i).*B(i)) ;
end
YOu have asked 221 questions so far....and still you stuck in basics of MATLAB. I strongly recommend you to read basic tutorials of MATLAB.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by