Answer to Question #178992 in MatLAB for Sunil

Question #178992

According to a dietician, a person should consume exactly 200 gm of carbohydrates, at least 175

gm of proteins and at most 150 gm of fats in a meal. The dietician also recommends to have as

much amount of vitamins as possible. The three food items that the person eats has 80, 65 and 30

gm of carbohydrates per kilogram of food item. The same food items contain 10, 12, 23 gm of

proteins in each kilogram. Per kilogram of the same food items comprise of 32, 56 and 42 gm of

fats. Vitamins contained in per kilogram of the same food items are 70, 37 and 58 gm.

Determine how much kilogram of each food item the person should consume so as to have

maximum intake of vitamins by using appropriate built-in function present in MATLAB.


1
Expert's answer
2021-04-07T04:04:45-0400
carb = [80, 65, 30];    % carbohydrates in 1 kg of foods
prot = [10, 12, 23];    % proteins in 1 kg of foods
fats = [32, 56, 42];    % fats in 1 kg of foods
vit = [70, 37, 58];     % vitamins in 1 kg of foods

carb_ex = 200;          % exact number of cabohydrates
prot_min = 175;         % minimal number of proteins
fats_max = 150;         % maximum number of fats

A = [-prot
     fats];
b = [-prot_min, fats_max];
Aeq = carb;
beq = carb_ex;
lb = [0, 0, 0];
ub = [100, 100, 100];

x = linprog(-vit, A, b, Aeq, beq, lb, ub)

The problem is unsolvable. As each food has more fats than proteins but proteins must be consumed more than fats.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS