How do I plot first order function? New to Matlab

Hi! New to Matlab so I have no knowledge. I have some knowledge in C++ and Java and C.
I want to plot the function y=3x+2 So I guess I have to declare 2 variables x and y and plot y for a range of values of x. How do I do this? I am running Matlab2015a-SP1

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 5월 6일
편집: Azzi Abdelmalek 2016년 5월 6일
x=0:0.01:20
y=3*x+2
plot(x,y)
Or use fplot
y=@(x) 3*x+2;
range=[0 20];
fplot(@(x) y(x),range)

추가 답변 (0개)

카테고리

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

태그

질문:

2016년 5월 6일

댓글:

2016년 5월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by