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

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 16일
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

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2016년 4월 16일

댓글:

2016년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by