MATLAB Code For Analyzing Experimental Data

In summary, the conversation discusses the possibility of creating a more generalized and automated MATLAB code for data analysis. The speaker, an REU student, has already developed a program that can create plots and graphs, save data and figures, and extract data from raw data. They are considering making this program more user-friendly and open-source for others to use. The conversation also mentions the potential for commercial use and the presence of other similar programs in the market.
  • #1
person123
325
51
TL;DR Summary
I'm in the process of writing MATLAB code to analyze data and I'm interested in how useful it would be for more general purposes.
Hi! I'm working on MATLAB code to analyze dat for a specific project, but I'm curious if it could made useful for more general purposes. Here's a bit of background on the project:

I'm an REU student and I was assigned to analyze data for a recently conducted experiment. The experiment took place in the wave basin at Hinsdale Wave Research Laboratory. Two wooden model houses were in the basin and impacted by waves until they broke. There were pressure gauges and load cells to measure uplift, accelerometers to determine the structural response of the building, ADVs, and wave gauges to measure water depth. Currently however, I have not analyzed accelerometer and ADV data. While analyzing data, I made it more and more automated until it became a sort of rudimentary program. Currently it can do the following (the idea being that if it were to be generalized, the user could write code to add more functions):

  1. A GUI is used to make it more user friendly.
  2. It can create plots comparing parameters. The title, labels, and legend title (the legend values are automatically generated based on a third parameter) are automatically generated.
  3. It has a constants class in which constants can be added. These include physical constants (g and water density for me), dimensions (of the house and sensor coordinates for me), the directories everything should be saved (more on that next), and the data which I extracted from the raw data (more on that in 7).
  4. It can automatically save figures in the proper folder and update the figures in a PowerPoint. I haven't gotten around to making it update a Word document, but a quick check online makes me think it's similar to updating a PowerPoint.
  5. It can automatically produce graphs from the raw data (original data, phase averaged or Fourier transform).
  6. It can automatically produce some other graphs more specific for me:
    1. Scatter plot comparing wave heights with and without house in basin.
    2. Animation of pressure gauge readings.
    3. Phase average of uplift and moment on building. A function computes the uplift and moment based on the pressure gauges (for the load cells it's easier of course).
    4. A comparison of two methods for computing uplift and moment from pressure gauges (using a linear regression and tributary areas for each gauge).
    5. A bar graph for comparing standard deviation across length of house versus along width (to see if it's fair to assume that pressure doesn't vary along width of house).
  7. It can automatically generate data based on the raw data. For me, this includes:
    1. Wave height for different trials (from wave gauge readings).
    2. Standard deviations for pressure gauges (mainly used for bar graph).
    3. Uplifts and moments for houses
I started thinking this could be made more general. The functions and constants I have could be the built-in ones, but then the user could create more things in MATLAB (new constants, new types of graphs, new data to extract from the raw data etc.) They could then use the GUI with those user-defined additions.

Is this a reasonable idea? Would it be useful for projects outside of the one I'm specifically doing? At the moment, I don't really have time to work on it if it isn't applicable to my specific assignment, but I would be definitely interested in continuing to work on it after summer if it would be a feasible idea.

Thanks in advance!
 
Last edited:
Physics news on Phys.org
  • #2
There is a long tradition of productivity tools arising from people automating their own work. Think of text editors and word processors as a prominent example.

But because it is so common, it is likely that there are many other packages out there that do similar things. Think of text editors again. So the better question is not absolute feasibility but relative feasibility.

If you want to develop it as a commercial product, or even an open source project, I think your next step is research on what products and projects already exist. Open source projects generally have a discussion forum associates, so you could post your ideas there and ask for reactions.

But even if you don't get others using it, there can be the joy of creativity continuing development for your own use. Think of text editors for a third time. No matter how many editors we have, it is great fun to make your own from scratch. Because of that, I expect to see new editors appearing perpetually.
 
  • #3
Thanks very much for the response! Honestly, I didn't even consider making it a commercial project a possibility; I was thinking of maybe uploading it to GitHub and that's about it. I have finished writing a very crude version of the program. The interface is very basic, but you are able to make custom constants, custom parameters and your own types of graphs. It works around a class which has Constant properties and methods for creating parameters; the user can then change the class itself to add more (it is designed to minimize the amount they would have to do). They can also open a template function in which they can write code to create their own type of graph, and other code inside the template integrates it with the rest of the program. I don't think I'm going to add much more now, because I'm really just using for myself though. I'm also generally discouraged from working on it, which is fair enough considering they need me to work on one specific task now, and they really have no reason to think I'm particularly good at coding (I have very little actual experience).
 
  • Like
Likes anorlunda
  • #4
You are right. There are large corporate groups that have most of their tools and analysis done in MATLAB code. There are also extensions to do simulations (Simulink), generate C-language code for real-time embedded programs, perform data analysis, etc. The extensions can be expensive. MATLAB is a major player in the engineering analysis world.
 
  • #5
FactChecker said:
You are right. There are large corporate groups that have most of their tools and analysis done in MATLAB code. There are also extensions to do simulations (Simulink), generate C-language code for real-time embedded programs, perform data analysis, etc. The extensions can be expensive. MATLAB is a major player in the engineering analysis world.
That actually sounds amazing because if people are paying for things like this, I would imagine it would be useful to people if I were to opensource it -- would it? (Honestly, if it helps me with my project and it's something for my resume, I would already be happy -- other people actually using my code would be incredible to me).
 
  • #6
I think you are reaching a stronger conclusion than I would. Most of the code that I have seen was developed specifically for the problem that the engineers were working on. I'm not sure how much they could use more generic opensource code. A lot of the general utilities are already available.
 
  • #7
FactChecker said:
I think you are reaching a stronger conclusion than I would. Most of the code that I have seen was developed specifically for the problem that the engineers were working on. I'm not sure how much they could use more generic opensource code. A lot of the general utilities are already available.
I could make it specific to something I'm knowledgeable about (like something hydraulics related) instead of making it general to all of engineering. All the built in constants parameters and plot types would be specific to that. I'm essentially working from specific to general, so this may even happen naturally. (I'm not going to start by creating a program for all of engineering or physics and try to implement everything). I could then use it for research I'm doing at school (also hydraulics related).

Also, out of curiosity, what is the opensource code which is similar to this? (If I were to ask my mentor, he would probably have no idea what I'm talking about).
 
  • Like
Likes FactChecker
  • #8
By all means, give it a try. It's disappointing that the company you work in does not recognize your enthusiasm. Maybe they are not aware. Be sure to let them know of your interest.

Information about which MATLAB software which is used in studying hydraulic problems can probably be obtained in the engineering sections of this forum.
 
  • #9
To be fair, they do have good reason not to.

1. I'm only 19.
2. I'm an reu student. Although I'm getting paid it's not really a job.
3. I only started learning Matlab a year ago. As far as they're concerned, all I know is what I learned in my intro to Matlab course (stuff like loops, branches, just touched on classes). Almost everything was self taught ( mainly through research at my school).
4. I was not assigned to write code per say but rather just to make some graphs to help others visualize the data.
5. I only briefly mentioned my knowledge of Matlab when introducing myself. I would say I learned more about coding at an abstract level these two weeks then I did the rest of my time learning it.
6. They want to make sure they have these plots created soon as possible.
7. Although they think my plots are decent, I'm always assigned to add more (add a caption, add a time series to an animation etc.) It can distract me a bit from working on the code, but I think it does force me to keep my code practical because I constantly have to use it while I'm writing it
 
  • Like
Likes FactChecker
  • #10
Keep up the good work. I think you will not be disappointed in the long run.
 
  • Like
Likes person123
  • #11
It sounds like you have the urge to create. Good for you.

Thousands of open source programmers share that characteristic. You might consider joining them. You'll probably begin joining an existing project and working with others. The online chats with the others might offer you valuable career advice.

Posting to Github is a lot like writing a blog. You're never sure how much impact it has on others because of lack of feedback. Working on a project with others is IMO, more satisfying.
 
  • Like
Likes FactChecker
  • #12
I think I'm going to save some new code which doesn't have all the stuff specific for my project, document a bit with comments (and maybe warnings and errors if I can get that working) upload it to discord and put the link here so anyone who wants can view or edit it. I think I should have that done my Monday hopefully.
 
  • #13
anorlunda said:
You'll probably begin joining an existing project and working with others.

I don't quite understand how I would integrate what I wrote into an existing project. Or do you mean working on something else? I don't really want to do that, both because I want to use it for the research I'm doing and because my interest lies more in the physics and engineering as opposed to the code itself.
 

What is MATLAB?

MATLAB is a high-level programming language and interactive environment used for technical computing and data analysis. It allows for efficient manipulation and visualization of data, as well as the implementation of complex mathematical algorithms.

How can I use MATLAB to analyze experimental data?

MATLAB provides a variety of built-in functions and tools for data analysis, including statistical analysis, signal processing, and curve fitting. It also allows for easy data import and export from various file formats, making it a powerful tool for analyzing experimental data.

What are the benefits of using MATLAB for data analysis?

MATLAB offers a user-friendly interface and a wide range of functions and tools that make data analysis faster and more efficient. It also has powerful visualization capabilities, allowing for the creation of high-quality graphs and plots to better understand and present data.

Can I customize my data analysis code in MATLAB?

Yes, MATLAB allows for the creation of custom functions and scripts to perform specific data analysis tasks. It also has a large community of users who share their code and offer support for customization.

Is MATLAB suitable for all types of experimental data?

Yes, MATLAB can be used to analyze a wide range of experimental data, including numerical, textual, image, and signal data. It also has various toolboxes and add-ons that cater to specific data types, making it a versatile tool for data analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Programming and Computer Science
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top