Need help plotting two functions

I have to plot an acceleration equation and pressure equation at x=0 and x=2:
a = 12x + 12y
p = -48.26 - 17.99y
How do I plot these with title and axis and at those points specifically?
EDIT: these need to be separate graphs also, sorry I didn't mention that

4 Commenti

Since this is surely homework, what have you tried? Show your effort if you want to see help.
cswiz
cswiz il 28 Ott 2022
I haven't. I'm not in coding classes, and I don't know how to code. This was an add on to a problem where she said to use MATLAB. I had to download it for this.
Rik
Rik il 28 Ott 2022
Regarding your flag ("not helpful. especially not for a beginner with no experience, it was kind of rude and discouraging. definitely wouldn't go to them for help ever again."):
If you don't know Matlab, you're the same as everyone at some point. You will have discovered Matlab can be a daunting behemoth when you first start using it.
The question John asked you is not rude nor unhelpful, it is just not sugar-coating. If a student comes here for help with their homeword and gets copy-paste-ready answers, what would they learn? That someone else will do the work for them. By showing what you tried you prove that you are willing to put in work, while also giving an indication of your skill level. This helps motivate us to answer your question and guides us in the level of explanation required.
You may consider doing the Onramp tutorial (which is provided for free by Mathworks) to get familiar with the basics of Matlab. Learning to use a tool as powerful as Matlab can be very helpful.
You shouldn't be discouraged. With a current count of 6.4k answers to his name, I think John has proven through his actions to be helpful. You shouldn't forget that communication in text is always hard, especially if you don't know whether you share the same cultural background or native language. The (in)famous Dutch directness that I have can also sometimes be percieved as rude, while the intention is to do you the courtesy of not wasting your time by beating around the bush.
We get a fair number of first-time posters who post a block of code, and ask us to explain it "it detail". Suppose for example that we recognize it as being code to do finite element mesh approximation of a differential equation (such as heat diffusion), then to explain the code "in detail", we would have to explain:
  • fundamental arithmetic, such as numeric bases (we can't assume they know about base 10 or base 2)
  • floating point arithmetic and the various limitations of that
  • numeric analysis (typically a third year university course for computer science or mathematics)
  • calculus
  • geometry, algebra, and linear algebra
  • differential equations
  • chemistry (descriptive properties of materials such as moles and heat capacity are usually classified as chemistry)
  • physics (mechanisms of transfer of energy are usually classified as physics)
  • computer science in general
  • MATLAB in particular
So, every time someone posts a question without giving us an indication of what they already understand, and what their specific questions are, then they are pretty much asking us to reply with about three complete textbooks of material, covering about 5 or more university level courses.
Is it any wonder, then, that the volunteers might say that posters need to put more effort into their questions before the posters can expect to receive a useful reply?

Accedi per commentare.

 Risposta accettata

Examples:
p = @(y) 42 + 6*y;
y = [-3 -1 0 2 3];
plot(y, p(y), '*-')
xlabel('y'); ylabel('p')
title('p')
a = @(x,y) 2*x.^2 - 3*cos(y);
fsurf(a, [-2 2 -pi pi])
xlabel('x'); ylabel('y'); zlabel('a')
title('a')

Più risposte (0)

Categorie

Scopri di più su Particle & Nuclear Physics in Centro assistenza e File Exchange

Prodotti

Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by