# Matlab: Custom Graph

1. Nov 29, 2008

### Air

How can I draw a graph on Matlab which is custom. I want to add peaks to a curve. I've drawn a simple quadratic curve but want to add some custom peaks. What code would I type? Is is possible to do such a thing on Matlab? Thanks in advance.

2. Nov 29, 2008

### Dr Transport

If you have written a function to calculate a quadratic, write a function for a Gaussian and add the matrices before plotting.

3. Nov 29, 2008

### Air

Not to calculate the quadratic, I have plotted:

Code (Text):
x=0:.5:20;
y=(x-5).^2+10;
plot(x, y);
But I want to add some peaks. Make a custom graph. Sorry but I don't understand what you mean.

4. Nov 29, 2008

### shoehorn

What do you mean you "want to add peaks to a quadratic"?

I can probably help you out with this since I've been using Matlab for years, but I've never heard that particular phrase before.

5. Nov 29, 2008

### Dr Transport

Code (Text):

clear all;

x = 0:0.01:20;

y = (x-5).^2+10;

y1 = 25*exp(-((x-10).^2)/0.5);

y2 = y+y1;

plot(x,y,x,y1,x,y2);

From here add more layers of the Gaussian that I have set up for you.