crate a x y graph with interconnected points related to two curves that have in y the values of weight between 0 and 1 and in x the values of time in hours. request input for time and weights in matlab

You can create an xy graph for your weight data versus time using the plot function in MATLAB. Here is an example code that takes user inputs for time and weight points and plot them on the graph:

main.m
% Get user input for time and weight points
time = input('Enter time points separated by a comma: ');
weight = input('Enter weight points separated by a comma: ');

% Plot the data points and add grid lines
plot(time, weight, '-o')
grid on;

% Add labels and title to the graph
title('Weight vs Time')
xlabel('Time (hours)')
ylabel('Weight')
342 chars
13 lines

Once you run the code, it will prompt you to enter time and weight points separated by a comma. You can enter any number of data points. Then, it will plot the points on the graph and add labels and title to it. Here is an example output of the graph:

xy graph example

related categories

gistlibby LogSnag