How do I plot physics experiment data in MATLAB with axis labels?

15 replies · 3K views · last reply
Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
I have some datas from our physics experimetn and we have to plot them on matlab.Idk how to do them,I don't know how to write codes.Also I have to write of the axises and table names
 
If you have no programming experience and you've never used MATLAB before then it's very, very difficult to help you without literally writing your code for you.
Do you have any group members who are familiar with MatLab? If not, then I highly recommend talking to your teacher about this.
 
Drakkith said:
If you have no programming experience and you've never used MATLAB before then it's very, very difficult to help you without literally writing your code for you.
Do you have any group members who are familiar with MatLab? If not, then I highly recommend talking to your teacher about this.
I wrote codesbefore just I lost them and I don't remember...
lewando said:
thanks seems usefull
 
The simplest plotting program is
Matlab:
X=[0:0.1:10];
Y=X.*X;
plot(X,Y);

In your case replace x and y values with your data to get your plot.

From there you can find some Matlab tutorials to help you further or ask here when you've some specific programming problem.
 
Note that MATLAB uses matrices and vectors to store variable values, so some of the operations need a period before them. For example, in jedi's post just above mine, the period just before the asterisk is required since you're doing an element by element operation. In other words:

##y=x.*x##
is not the same thing as:
##y=x*x##

Leaving out the period will give you an error.
 
You haven't really given us enough information to be able to help you. We have no idea what kind of graph you want, what kind of data you have, what experiments you've done, etc.
 
Drakkith said:
You haven't really given us enough information to be able to help you. We have no idea what kind of graph you want, what kind of data you have, what experiments you've done, etc.

Ok wait a sec I ll give all data
 
We made a electrostatic experiment.Here is the pdf of the experiment.
Now I plot my data for Part (A). The graph should look like this,(Charge-time thing )
I have charge,time data.
And I get this ( in the attachments sections)
they y-axis is charges and the x-axis is time.From my data I can see that positive charge is 0,004C and negative should be -0,004C.In the graph its not obvious cause boundries conflict with my data result and graph looks weird and there's also a gap in 11,1-11,5 seconds.The data in that part is in the attachments.

I hope this helps
 
Attachments
  • EXP-1_20162.pdf
    EXP-1_20162.pdf
    444.2 KB · Views: 1,389
  • Hand-drawn sketch of a charge versus time graph with axes labelled Charge and Time: charge rises from zero to a positive plateau, drops steeply through zero to a negative plateau, then returns to zero.
    Charge-Time.png
    47.7 KB · Views: 579
  • MATLAB figure of a plotted line with x-axis from 0 to 25 and y-axis scaled by 10^-3 from -4 to 4, showing jumps to the top and bottom limits, a flat stretch near zero, and a gap around x = 12 to 20.
    Matlab.png
    61.6 KB · Views: 615
  • Notepad window listing tab-separated time and charge values, times from 10.9400 to 11.6800 seconds, charges moving from about 4.883E-5 through 0 to negative values near -0.003.
    data.png
    30.6 KB · Views: 585
I have also a question.First we lowered the white stick and charge data give us positiive value..But the measurement device measures the potentail difference between the pails.So then white pail should be charged negative so can potential difference can be positive ? (First 2 questions )