Home > Net >  How do I graph a vector with a variable on MATLAB
How do I graph a vector with a variable on MATLAB

Time:03-27

How can I graph something that looks like this (3x^2 5,4x) , I usually use GeoGebra to graph this but I can't put a domain it should look like this (GeoGebra)enter image description here

CodePudding user response:

From the graph, you seem to be taking 3x² 5 on the horizontal axis and 4x on the vertical axis and hence:

x = -5.5: 0.01: 5.5;
plot(3*x.^2 5, 4*x, 'r');

%other minor adjustments to match with the graph in your post
grid on;    grid minor;    %to display grid lines
set(gca, 'XAxisLocation', 'origin');  %setting x-axis location to 'origin'
legend('eq2'); %to display the legend

which gives:

[1]: https://i.stack.imgur.com/R6ilI.png

CodePudding user response:

Something like this should do it:

y = -10:0.1:10;
x = 3 * y.^2   5.4 * x;

plot(x, y)
grid on
  • Related