How can I plot a function?

4 vues (au cours des 30 derniers jours)
Ioannis Filippidis
Ioannis Filippidis le 8 Avr 2021
Hello everybody,
I am new in Matlab (student) and i m trying to plot this:
x=1:5:800;
y=@(x)4*3.14*28*10^9*x/(3*10^8);
plot (x,y)
But when i run it shows me this:
Error using plot
Invalid data argument.
Error in freespace (line 3)
plot (x,y)
What am i doing wrong?
Sorry for my english

Réponses (1)

DGM
DGM le 8 Avr 2021
Try this:
x=1:5:800;
y=@(x) 4*pi*28*10^9 * x/(3*10^8); %i'm assuming you want pi there
plot(x,y(x)) % use it as a function
  1 commentaire
Ioannis Filippidis
Ioannis Filippidis le 8 Avr 2021
Thanks.That helps

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB 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!

Translated by