Question

In: Electrical Engineering

****MATLAB QUESTION**** As an enthusiastic and motivated student you decide to go out and buy plenty...

****MATLAB QUESTION**** As an enthusiastic and motivated student you decide to go out and buy plenty of pens for all your classes this semester. This spending spree, unfortunately, occurred before you realized your engineering classes seldom require the use of "ink". So now, you're left with four different types of pens and no receipt-you only remember the total amount you spent and not the price of each type of pen. You decide to get together with three of your friends who coincidentally did the same thing as you, buying the same four types of pens and knowing only the total amount.

Write a script to find the prices of each type of pen..

Solutions

Expert Solution

Four different types of Pens are : A,B,C,D

We know total amount too. We can solve this by making four equations with four unknowns

And coefficients of our equations are number of pens we bought.

a A + b B + c C + d D = Z

This equation represents buying a pens of Type A , b pens of Type B, c pens of Type C and d pens of Type D and

Z is total amount.( of one person)

We have four persons , so we get four equations

a1 A + b1 B + c1 C + d1 D = Z1

a2 A + b2 B + c2 C + d2 D = Z2

a3 A + b3 B + c3 C + d3 D = Z3

a4 A + b4 B + c4 C + d4 D = Z4

Now we solve these equations in matlab .

CODE :

OUTPUT :

RAW_CODE :

%take this example equations
% change coeffiecients and final amount with your samples
% 2A + 1B +0C + 6D = 64
% 5A + 2B +0C + 0D = 37
% 0A + 7B +2C + 2D = 66
% 0A + 0B +8C + 9D = 104
coefff_matrix = [2,1,0,6; 5,2,0,0; 0,7,2,2; 0,0,8,9];
final_amount = [64; 37; 66; 104];

% solving equations
X = inv(coefff_matrix)*final_amount;
% we can also use X = coefff_matrix \ final_amount

fprintf('price of type1 pen : %f\n',X(1));
fprintf('price of type2 pen : %f\n',X(2));
fprintf('price of type3 pen : %f\n',X(3));
fprintf('price of type4 pen : %f\n',X(4));


Related Solutions

You decide to buy a new car, with a drive-out price of $37,500. You finance the...
You decide to buy a new car, with a drive-out price of $37,500. You finance the car at 4.8% APR for 5 years, with end of month payments. Answer the following questions. Show your inputs for potential partial credit. Show your answer to the nearest $.01 a. What is your monthly payment? b. How much of your 25th payment is payment of principal? c. Over the entire life of the loan (assuming you pay on time), what was the total...
You decide to study that all important question of the average height of the UTEP student...
You decide to study that all important question of the average height of the UTEP student body. The answer to this question is essential to your future, so we need to study it correctly. You decide to sample 64 students. You set up the following test: H_o: Average height ≥ 59 inches H_a: Average height < 59 inches. 1) Draw the table that shows the 4 possible scenarios of Reality vs. Experimental Outcome. What are the types of errors? Which...
You decide to study an important question of the average height of the ASU student body....
You decide to study an important question of the average height of the ASU student body. The answer to this question is essential to your future, so we need to study it correctly. You decide to sample 64 students. You set up the following test: H_o: HYB Average height ≥ 59 inches H_a: Average height < 59 inches. 1) Draw the table that shows the 4 possible scenarios of Reality vs. Experimental Outcome. What are the types of errors? Which...
A few years out of UCCS you’re earning $125,000 and decide to buy a condominium. The...
A few years out of UCCS you’re earning $125,000 and decide to buy a condominium. The one you like will cost $300,000. The bank will require a 15% down payment and will lend you the difference in a 30yr traditional mortgage at an interest rate of 4.800%(M). For three years from the day you bought the condo, Colorado real estate continues to climb. Your condo appreciates 4% every year for three years. And, interest rates fall to 3.60%(M). You decide...
After starting your first full-time job out of college, you decide to buy a new car...
After starting your first full-time job out of college, you decide to buy a new car for $12,000. Using Excel, create a complete amortization table for this car-loan: You make 36 equal end- of- month payments. The discount rate is 7.25% compounded monthly. How much would you owe after the 15th payment is made?
So, you go into a Best Buy and you want to buy these wonderful, sparkly gadgets...
So, you go into a Best Buy and you want to buy these wonderful, sparkly gadgets called phones. These phones require a signature where you are agreeing to pay a certain amount each month depending on the phone that you like and it gets added onto your contract. You are a 17 and a half year old who just got a job at Chipotle. You are so excited and you want to use your paycheck and sign up for the...
How often do you go out dancing? This question was asked by a professional survey group...
How often do you go out dancing? This question was asked by a professional survey group on behalf of the National Arts Survey. A random sample of n1 = 97 single men showed that r1 = 24 went out dancing occasionally. Another random sample of n2 = 91 single women showed that r2 = 19 went out dancing occasionally. Note: For degrees of freedom d.f. not in the Student's t table, use the closest d.f. that is smaller. In some...
How often do you go out dancing? This question was asked by a professional survey group...
How often do you go out dancing? This question was asked by a professional survey group on behalf of the National Arts Survey. A random sample of n1 = 98 single men showed that r1 = 24 went out dancing occasionally. Another random sample of n2 = 93 single women showed that r2 = 18 went out dancing occasionally. Note: For degrees of freedom d.f. not in the Student's t table, use the closest d.f. that is smaller. In some...
Suppose you are buying an $80,000 car , you decide to buy it and get it...
Suppose you are buying an $80,000 car , you decide to buy it and get it financed and make monthly payments.Your budget is $3,000 for monthly payments, and you can get financing at 11% APR. With the help of an amortization table, show approximately how long will it take you to pay the loan back? Remember the monthly payment must be around your budget. Work with Excel. Copy and paste the first four months and last two months of the...
On a beautiful day you decide to go for a bicycle ride. First you ride for...
On a beautiful day you decide to go for a bicycle ride. First you ride for 10 miles at 30 degrees south of east and then for 8.0 miles at 60 degrees north of west. What is the magnitude of your displacement?   options: a 12.7 mi b 0 c 4.8 mi d 15.5 mi e 18 mi
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT