Clear Filters
Clear Filters

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

1 view (last 30 days)
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;

Accepted Answer

KSSV
KSSV on 12 Apr 2018
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.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!