Question
please do everything in matlab with commets next to each line of code thank you!
%% Problem 1 - 1 point % Create a 100-element array, A, which is a random array of integers % Use the randi function for this
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc%clears screen
clear all%clears history
close all%closes all files
disp('Problem 1');
A=randi([1,10],1,100)
disp('Problem 2');
ct=0;
for i=1:100
if(mod(A(i),2)==1)
ct=ct+1;
end
end
disp(ct);
disp('Problem 3');
v=[];
ct=0;
for i=1:100
if(mod(A(i),2)==0)
v=[v A(i)];
ct=ct+1;
if(ct==10)
break;
end
end
end
disp(v);

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
please do everything in matlab with commets next to each line of code thank you! %%...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code...

    java code please 14. Next we'll complete the setValues() method. Instead of giving you exact code I'll tell you what to do. Use other code as a guide.  Start with a for loop with a start of int i = 0  Set the ending point of when i is less than the length of the arr array.  Set the incrementation to increase i by 1 using the unary operator ++.  Within the loop set the arr...

  • Write a MATLAB code to generate an array of 100 random integers between 1 and 10...

    Write a MATLAB code to generate an array of 100 random integers between 1 and 10 using the command “randi”. Using “if” statement, impose the condition that if a number in the array is greater than 5, the number is modified as, number = number – 11. Find the sum of the array and store it. Repeat this exercise for 10, 1000 and 100000 trials and plot the following: (a) Sums obtained vs trails number (b) Histogram of the sum...

  • Please answer question on MATLAB showing work and the script. Thank you. Create a function M-ile...

    Please answer question on MATLAB showing work and the script. Thank you. Create a function M-ile that will implement a for loop to perform the tollowing tasks for a random input array, tt x. Count how many elements are greater than an arbitrary integer and display these values as well as the count using fprintf. loop to perform the following tasks Create a function M-ile that will implement a for l for a random input array, x. Calculate the arithmentic...

  • Use MATLAB to solve this problem. Thank you. Upload the assignment to CANVAS, it should include...

    Use MATLAB to solve this problem. Thank you. Upload the assignment to CANVAS, it should include two things: the PDF and the zipped folder. Late assignments are not accepted. For the questions below, do not create the arrays or matrices by hand. Instead, use built-in MATLAB functions and shorthand notations. Otherwise, no points will be given. 1) Create a function called my product that computes the multiplication of the numbers in any vector using a while loop. The function should...

  • For this In-Class Exercise, you are asked to build a MATLAB code that makes a few...

    For this In-Class Exercise, you are asked to build a MATLAB code that makes a few assignment statements and a logical test with random numbers. To answer this ICE, you will need to upload a screenshot of your successful run showing ALL of the outputs. Remember to use good programing skills for the code. For your outputs: If your output for a step below is a single value, use a command similar to:fprintf(‘Question 5 answer: %4.3f \n,A) or fprintf(‘Question 5...

  • For this In-Class Exercise, you are asked to build a MATLAB code that makes a few...

    For this In-Class Exercise, you are asked to build a MATLAB code that makes a few assignment statements and a logical test with random numbers. To answer this ICE, you will need to upload a screenshot of your successful run showing ALL of the outputs. Remember to use good programing skills for the code. For your outputs: If your output for a step below is a single value, use a command similar to:fprintf(‘Question 5 answer: %4.3f \n,A) or fprintf(‘Question 5...

  • (+30) Provide a python program which will Populate an array(list) of size 25 with integers in...

    (+30) Provide a python program which will Populate an array(list) of size 25 with integers in the range -100 (negative 100)   to +100 inclusive Display the array and its length (use the len function) Display the average of all the integers in the array Display the number of even integers (how many) Display the number of odd integers (how many) Display the number of integers > 0   (how many) Display the number of integers < 0   (how many) Display the...

  • An array containing 10 integers is stored in data section of the MSP432 memory. Array1_ptr is...

    An array containing 10 integers is stored in data section of the MSP432 memory. Array1_ptr is a pointer that points to the first element in this array, and is defined in the .data section of MSP432 memory. Write a code in ARM assembly to analyze every element of the array and count the total number of even integers. Multiply only the odd numbers by 2 and copy the even numbers on another stack pointed to by array2_ptr. Assume that you...

  • Using Matlab Prompt the user for a number between 1 and 20. integers. Fill up each...

    Using Matlab Prompt the user for a number between 1 and 20. integers. Fill up each slot of the array with a random number from 1 to 100. Then display the contents of the array on the screen. You must use a loop. 7. Create an array that holds this number of

  • Matlab. Please add comments. Thank you in advance. 15. Write a code that can read in...

    Matlab. Please add comments. Thank you in advance. 15. Write a code that can read in a string and replaces all vowels with x's 16. Write a function that reads in a D array of any length, u, and swaps elements of the array in the following way. The first and last element are swapped. The second and second to last element are swapped. The third and third to last element are swapped, and so on until all the elements...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT