Multiple input values for same function and plot them?
이전 댓글 표시
Hello,
I was wondering if there was a quick clean and easy way to make a function input multiple values of x, such as 0, .25 ,.5, .75, 1 and then plot these five curves out on the same plot. I know how to do it manualy by create 5 different functions and naming them slightly differently, but I was wondering if there was a quicker/cleaner way of doing it?
댓글 수: 4
Image Analyst
2019년 11월 27일
Those are 5 scalars, not 5 functions or curves. You can use "hold on" to plot multiple curves on one plot.
plot(x1, y1);
hold on;
plot(x2, y2);
plot(x3, y3);
Adam Danz
2019년 11월 28일
In plot(x,y), if x and y are matricies, a line will be drawn for each column of the inputs. There are additional ways to get multiple lines out of one set of inputs and that's all examples in the documentation.
KSSV
2019년 11월 28일
MAke the input as amtrix and plot in one strectch.
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!