# MATLAB CODE FOR ploting

Discussion in 'Programmer's Corner' started by Ahmad Alomari, Mar 23, 2012.

Mar 22, 2012
8
0
please help me to plot the figure attached by matlab..which represents the charge density in the junction region of p-n junction
and thanks all.. thanks thanks thaaaaanks

File size:
12.8 KB
Views:
36
2. ### steveb Senior Member

Jul 3, 2008
2,431
467
How are you generating the data for the plot? Do you have a formula, or a data file?

Mar 22, 2012
8
0
I want to plot these two figures by matlab ana I need the matlab code please..

File size:
118.3 KB
Views:
48
• ###### Untitled1.jpg
File size:
83.8 KB
Views:
45

Mar 22, 2012
8
0
---
I attached them in a photos
---
---

Last edited by a moderator: Mar 25, 2012

Mar 22, 2012
8
0
by the equations in the two figures attached ..thanks

6. ### steveb Senior Member

Jul 3, 2008
2,431
467
Matlab has many plotting tools. It also has good help information. Look up commands such as plot, title, xlabel, ylabel, axis, legend, semilogx, semilogy, plottools, loglog, and grid.

You also need to understand simple programming to convert your formula into a data set that can be plotted. A simple program that could plot the function y=x^2 over the range -5<x<+5 would be as follows.

Code ( (Unknown Language)):
1.
2. i=1:100;
3. x=-5+10*i/100;
4. y=x.^2;
5. plot(x,y)
6. title('Plot of the function y=x^2')
7. xlabel('x-axis')
8. ylabel('y-axis')
9.

Mar 22, 2012
8
0
thanks very much..but what about my two figures ?

Mar 22, 2012
8
0
9. ### steveb Senior Member

Jul 3, 2008
2,431
467
You have to learn the commands and the programming methods to figure out how to make your two figures. The best way to learn is by doing. Try the commands. Go step by step. Make mistakes. Correct your mistakes. Post examples of your code here when you get stuck. Etc.