[SOLVED] How do I graph a vector with a variable on MATLAB


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


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

Answered By – Sardar Usama

Answer Checked By – Mildred Charles (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *