Plot Parabola from -20 to 20 in MATLAB

  • Context: MATLAB 
  • Thread starter Thread starter mishal
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary

Discussion Overview

The discussion revolves around plotting a parabola defined by the equation y = x^2 + 2x + 3 in MATLAB for the range -20 < x < 20. It includes requests for solutions, responses with code, and commentary on forum etiquette regarding homework questions.

Discussion Character

  • Homework-related
  • Technical explanation
  • Meta-discussion

Main Points Raised

  • One participant requests a solution for plotting a specific parabola in MATLAB.
  • Another participant provides a MATLAB code snippet to plot the parabola, suggesting it can be copied directly into the MATLAB Command Prompt.
  • A third participant comments on the appropriateness of answering homework questions directly in the forum, suggesting that such questions should be posted in designated sections.
  • There is a note about the potential for moderators to delete direct answers to homework questions and move them to appropriate subforums.
  • A later reply expresses gratitude for the information provided.

Areas of Agreement / Disagreement

Participants generally agree on the need for proper forum etiquette regarding homework questions, but there is no consensus on the appropriateness of providing direct answers in this context.

Contextual Notes

There are limitations regarding the categorization of the original question as homework, and the discussion does not resolve the appropriateness of providing direct solutions versus guiding participants to find answers themselves.

mishal
Messages
3
Reaction score
0
Plot the parabola which has the equation y = x^2+2x+3 for -20<x<20 using Matlab.
 
Physics news on Phys.org
need the solution
 
Hey, mishal,

This is the simple solution to your problem:
x = -20:0.01:20;
y = x.^2 + 2*x + 3;
plot(x,y);

You can copy and paste this into your Matlab Command Prompt. If you need more information, feel free to ask me.

By the way, you can search Matlab Help, that's very good source for self learning. And you can go to: http://www.mathworks.com/matlabcentral/index.html" to find more .m files that might help you.

PS: Mathematics is a suitable source for this kind of question. (Or Homework or Coursework questions)
 
Last edited by a moderator:
TChi, this is a particularly simple question, so what you did isn't particularly egregious, but we here at PhysicsForums try to help people work through their problems (especially when it's homework). Homework should be in the Homework section (there's an Engineering and CompSci section), but there's also a Computer Science and Programming subforum as well (and there's a Mathematical Software section within that--for things like MATLAB, Octave and/or Mathematica)

EDIT: mods will occasionally delete responses that out-and-out answer questions (that should be answered by the question asker), and move homework to appropriate subforums. Not to snerk, just to let you know.
 
hey thankyou so much for your kind information
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K