To plot a linear equation like x+y=69
in MATLAB, you can create a vector of x
values, calculate the corresponding y
values using the equation, and then plot the points. Here's the code to do that:
main.m202 chars14 lines
This code creates a vector of x
values from 0 to 69 in steps of 0.1, calculates the corresponding y
values using the equation y=69-x
, and then plots the points using the plot
function. Finally, it adds labels and a title to the plot.
Note that this will plot a line, because it's a linear equation. If you want to plot a curve, you'll need a different equation.
gistlibby LogSnag