How do I plot first order function? New to Matlab
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alexandros
le 6 Mai 2016
Commenté : Azzi Abdelmalek
le 6 Mai 2016
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
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 6 Mai 2016
Modifié(e) : Azzi Abdelmalek
le 6 Mai 2016
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)
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!