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
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
15 replies · 2K views
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 import the data but my graphy looks weird,I don't know why andd btw I have 1100 variable.
 
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,377
  • Charge-Time.png
    Charge-Time.png
    47.7 KB · Views: 557
  • Matlab.png
    Matlab.png
    61.6 KB · Views: 590
  • data.png
    data.png
    30.6 KB · Views: 557
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 )