MATLAB Plotting Data with Matlab - Learn How to Code & Graph

Click For Summary
The discussion centers around plotting data from a physics experiment using MATLAB, with participants expressing challenges related to coding and data visualization. A user seeks assistance with MATLAB due to a lack of programming experience and familiarity with the software. Suggestions include self-study resources from MathWorks, emphasizing the importance of understanding MATLAB's syntax, particularly regarding element-wise operations with matrices and vectors. Participants discuss the specifics of the user's data, which involves charge and time measurements from an electrostatic experiment. The user reports issues with the graph's appearance, noting conflicts in data boundaries and gaps in the time series. Clarification is sought on the relationship between charge measurements and potential differences, raising questions about the expected signs of charge based on experimental outcomes. The conversation highlights the need for more detailed information about the data and the desired graph to provide effective assistance.
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
 
Physics news on Phys.org
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.
 
I have 100+ data.I remember some special code for it
 
What format is your data?

Search on google for Matlab code that reads data files.
 
In notepad.
 
  • #11
I ll look tomorrow in detail.
 
  • #12
I import the data but my graphy looks weird,I don't know why andd btw I have 1100 variable.
 
  • #13
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.
 
  • #14
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
 
  • #15
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,346
  • Charge-Time.png
    Charge-Time.png
    47.7 KB · Views: 538
  • Matlab.png
    Matlab.png
    61.6 KB · Views: 565
  • data.png
    data.png
    30.6 KB · Views: 532
  • #16
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 )
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K