Plotting Data with Matlab - Learn How to Code & Graph

  • Context: MATLAB 
  • Thread starter Thread starter Arman777
  • Start date Start date
  • Tags Tags
    Data Matlab Plotting
Click For Summary

Discussion Overview

The discussion revolves around plotting data using MATLAB, specifically in the context of a physics experiment involving charge and time measurements. Participants are seeking assistance with coding, graphing, and interpreting their experimental data.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses difficulty in coding and plotting their experimental data in MATLAB, indicating a lack of programming experience.
  • Another participant suggests that self-study is necessary and provides links to MATLAB documentation.
  • Some participants emphasize the challenges of assisting someone without programming experience, recommending collaboration with knowledgeable peers or instructors.
  • A participant shares a simple plotting code example and encourages others to replace the example data with their own.
  • There is a note about the importance of using element-wise operations in MATLAB, highlighting a common error related to matrix operations.
  • One participant mentions having a large dataset and recalls a special code for it, but does not provide specifics.
  • Another participant asks for clarification on the format of the data and suggests searching for MATLAB code to read data files.
  • Concerns are raised about the clarity of the information provided, with participants noting that more details are needed to assist effectively.
  • A participant describes their specific experiment and the issues they encounter with their graph, including unexpected results and gaps in the data.
  • Another participant poses a question regarding the relationship between charge measurements and potential difference, indicating confusion about the expected results.

Areas of Agreement / Disagreement

There is no consensus on the best approach to plotting the data, as participants express varying levels of understanding and experience with MATLAB. Multiple competing views on how to proceed remain, particularly regarding coding and interpreting the experimental results.

Contextual Notes

Participants have not provided sufficient details about the specific data format or the types of graphs they wish to create, which limits the ability to offer targeted assistance. There are also unresolved questions about the experimental setup and the interpretation of the results.

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,359
  • Charge-Time.png
    Charge-Time.png
    47.7 KB · Views: 544
  • Matlab.png
    Matlab.png
    61.6 KB · Views: 574
  • data.png
    data.png
    30.6 KB · Views: 544
  • #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
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K