MATLAB Practice Problem: Write a program which calculate the total profit/year by the end of each month in a year, given the variable P which stores profit/month for that year: P = [4 4 5 6 7 6 7 5 7 8 8 6]x1000
a) Set a loop up to calculate Ptotal(ii)=Ptotal(i-1)+P(i), to help decide about start/end conditions, use an iteration table.
b) Set up a loop to calculate Ptotal(i+1)=Ptotal(i)+P(i+1).
Here is the logic for you. Ofcourse, both loops will achieve the same thing. If you have any further queries, just get back to me.
P = [4 4 5 6 7 6 7 5 7 8 8 6]*1000;
display (P); %Displays the monthly profit.
Ptotal = [0 0 0 0 0 0 0 0 0 0 0 0];
%a) Set a loop up to calculate Ptotal(ii)=Ptotal(i-1)+P(i), to help decide about start/end conditions, use an iteration table.
Ptotal(1) = P(1);
for i = 2:12
Ptotal(i)=Ptotal(i-1)+P(i);
end
display (Ptotal);
%b) Set up a loop to calculate Ptotal(i+1)=Ptotal(i)+P(i+1).
for i = 1:11
Ptotal(i+1) = Ptotal(i)+P(i+1);
end
Ptotal(12) = Ptotal(11)+P(12);
display(Ptotal);
MATLAB Practice Problem: Write a program which calculate the total profit/year by the end of each...
I need this MATLAB question answered ASAP!!! thanks in
advance!
10 Write a program which prompts the user for data and returns the mean. The code should execute the following steps: 1) Prompts the user to enter the number of observations 2) Use a FOR-LOOP to get data from user. At each iteration, the user is asked for value of the i-th observation 3) At each iteration, print the mean of the sample up to and including the i-th observation...
Please complete using matlab
In this problem you will utilize a for loop to compute the an approximation of the value of using the Leibniz's formula for Pi. The formula uses a summation. Follow the instructions correctly and read the questions thoroughly. 1. Set up the initial number of iteration i to obtain six iterations. 2. The approximate value of it can be given by the following formula: Approximated = Enzo 2n+1 Where n is an integer starting at zero...
Hi, im trying to program a simple iteration in matlab to solve a bubbel point temparture. I tried to do a loop so i dont have to do all calculation separatly. Sadly i am not a god programmer so i need some help with that! What i want to achive is that for every T from 87 to 97 i want matlab to compute P1 and P2. The P1 and P2 are then used to calculate y1 which then is...
Matlab
Question 2. For this problem you have to create a program that defines two vectors of numbers: A and B and uses a for-loop to combine the values of A and B. Note that different parts of the question below specify different orders for combining the elements. To start this exercise start a MATLAB script called q2.m and put, at the top, the vector definition: B [11:20] Question 2a: Problem definition Copy the file q2.m to q2a.m. For this...
calculate the company's profit or loss at the year
end
Problem 1-4A Listed in alphabetical order, the following selected items (in thousands) were taken from Wildhorse Information Technology Company's December 31, 2017, financial statements: 1. Accounts payable $870 7. Rent expense 2 Accounts receivable 950 8. S. Wildhorse, capital, Jan. 1 3. Cash 3,800 9. S. Wildhorse, drawings 4. Consulting revenue 15,400 10. Salaries expense 5. Equipment 5,120 11. Utilities expense 6. Interest expense 710 $4,390 6,390 3,210 3,000 360...
MATLAB : Practice-4 (Oct. 31/ Nov. 1) Seat No. Name: Solve the following problems and write in the answers in blue and the plot in the box. Save the file in a pdf format and submit the answer script file and the pdf file to E-Class. 1. Re-do the Sample Problem 6-11 (Flight of a model rocket), but with the following conditions. - 16N force during the first 0.2 second - Parachute open when the downward velocity reaches 25 m/s...
Consider the following lines of Matlab code 1 arr-14,7.2,5,1,6: 2 for j 2:length(arr) 3 key arr) 4 i j-1; 5 while i - 1 && arr)> key 6 arr(+1) arr(); 8 end %end of while loop 9 arr(+1) key 10 end %end of for loop After line 8 gets executed the first time, the state of the array arr is. arr [4, 7, 7, 5, 1, 6] What is the state of the array arr after line 8 is executed...
Matlab problem
Write a function matsort to sort all of the values in a matrix (decide whether the sorted values are stored by row or by column). It will receive one matrix argument and return a sorted matrix. Do this without loops, using the built-in functions sort and reshape. For example: >> mat mat- 4 5 2 1 3 6 7 8 4 9 1 5 >> matsort(mat) 1 4 6 1 4 7 2 5 8 3 5 9...
MATLAB HELP
This is currently what has been written. The problem is that
pos needs to be answered in a row vector form. Currently it says
pos= 1 pos=4 pos=7 pos=8 in the command window when it is run. But,
I don't know how to change what is written to make it display as
pos = [ 1 4 7 8] instead. How would I change the code to pos to be
displayed as [ 1 4 7 8]?
vec...
Write them in python IDLE *****
5. Average Rainfall
Write a program that uses nested loops to collect data
and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop
will iterate once for each year. The inner loop will iterate twelve
times, once for each month. Each iteration of the inner loop will
ask the user for the inches of rainfall for that month. After all
iterations,...