Answer:
x = 29:73;
x_even = x(2:2:end);
Explanation:
In order to create a vector in Matlab you can use colon notation:
x = j:k
where <em>j</em> is 29 and <em>k</em> is 73 in your case:
x = 29:73
Then you can extract the even numbers by extracting the numbers with even index (2,4,6,etc.) of your vector:
x_even = x(2:2:end);
In the line of code above, we define <em>x_even</em> as all the elements of x with even index from index 2 till the end index of your vector, and an increment of 2 in the index: 2,4,6,etc.
If you want the odd numbers, just use the odd indices of your vector:
x_odd = x(1:2:end);
where <em>x_odd</em> contains all the elements of <em>x</em> with odd index from index 1 till the end index, and an increment of 2: 1,3,5,etc.
Answer:
Ok
Explanation:
I will check him out, do you need anything else though?
Answer:
IPv4 address. I guess, it's kind of tricky. lol
I can’t see the answer choices but I would like to say it’s JPEG am not sure. Could you at least provide the answer choices? Thanks!
Answer:
The output of code will be 10
Explanation:
We need to find output of following code:
C = 1
Sum = 0
while (c less than 10):
C = c + 3
sum = sum + c
print (sum)
Solution:
We will check the condition of while loop, if the condition is true, then the statements inside the loop will be executed. Since brackets are not available so, only one statement is linked with while loop.
First while loop will be executed c < 10 (1<10) the condition becomes true, and statement c=c+3 will be executed ( 4=1+3) and then loop condition will be checked (4<10) the condition becomes true, and statement c=c+3 will be executed ( 7=4+3) and then loop condition will be checked (7<10) the condition becomes true and statement c=c+3 will be executed ( 10=7+3) and then loop condition will be checked (10<10) the condition becomes false, so we will come outside loop body and execute: sum=sum+c (10=0+10) and print sum i. e 10
So, The output of code will be 10