Consider the array A A = 3 5 -4 -8 -1 33 -17 6 -9 Write a programme that computes the array B by computing the natural logarithm of all the elements of A whose value is no less than 1, and adding 20 to each that is equal to or greater than 1. Do this by using a logical array as a mask. [this should be done using matlab ]
I think you will get better help if you post this question in the Computer Science section.
@UnkleRhaukus
ok
also, : \[\huge{\color{blue}{\mathbb{Welcome}}\space \color{green}{\frak{To}}\space \color{orange}{\textbf{OpenStudy}}}\]
A=[3,5,-4;-8,-1,33;-17,6,-9]; % array A B=zeros(3,3); % array B (initially empty) for n=1:9 % number of elements if A(n)<1 % when the ellement is less than one B(n)=A(n)+20; % add twenty else % for everything else B(n)=log(A(n)); % take the the natural log end end B % display
Join our real-time social learning platform and learn together with your friends!