Ok so I have this script file that will give me 20 x values but only one y value. I need to have 20 of both and plot them accordingly. (x1,y1),(x2,y2),......(x20,y20). I know I'm missing some kind of loop statement but I'm not sure what it is. Any help would be appreciated. Thanks in advance.
clear all;
clc
format compact;
n=20;
x=1:n;
t=60;
for F=('female')
a= 21;
w= 115;
h= randi([153 175]);
F= ((((a*0.074)-(w*0.05741)+(h*.4472)-20.4022)*t)/4.184);
end
display(F);
for M=('male')
a=22;
w=258;
h=randi([163 184]);
M= ((((a*.2017)-(w*0.09036)+(h*.6309)-55.0969)*t)/4.184);
end
display(M);
figure;
plot(x,M,'*r',x,F,'k*');
title 'Calories Burned in 60 mins';
xlabel 'Days';
ylabel 'Calories';

2 commentaires

Azzi Abdelmalek
Azzi Abdelmalek le 16 Avr 2016
This is not clear, can you post an example?
I do not understand the workflow. Why do you need 20 values of x when you are only generating 4 values for 'male' and 6 values for 'female'? But if you can save the value of F for 'female', you can save 6 values for female and 4 for male. Something like this:
for F=('female')
a= 21;
w= 115;
h= randi([153 175]);
F= ((((a*0.074)-(w*0.05741)+(h*.4472)-20.4022)*t)/4.184);
f(k) = F;
k = k + 1;
end

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by