As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

Matlab Help!?

Britjade91Britjade91 Registered User regular
So i'm about to use Matlab for the first time in the first year of my PhD, and coming from a purely biomed background I have NO idea about the engineering/mathematic/computational side of this.

I'm going to be using it to create a math model for my biological system representing receptor-ligand interactions of the immune system in the cancer microenvironment.

So, i'm pretty scared. Terrified, actually.

Any advice on Matlab (breakdown of what it is, why used in biological systems, how to visualise it, good tutorials or textbooks for this purpose etc). I have some ideas, but i'd love to know others opinions more experienced than me!

Thanks!

Posts

  • MrTLiciousMrTLicious Registered User regular
    edited October 2013
    Matlab is a matrix-based language (sorry "environment"), similar in many respects to R. I don't know anything about biological systems, but I know in economic modelling it's mainly used just because it's easy to debug, and look at your data in the middle of your project. It's a fairly easy language if you have any coding experience at all, so I wouldn't worry too much about that unless you don't have any experience with coding/algorithms, in which your problems aren't going to be with MATLAB specifically.

    Edit: I guess that was pretty vague and potentially not helpful but I'm not really sure how to answer your question. I do have a lot of experience with MATLAB though, so if you have some specific questions that you don't want to put in thread, feel free to PM me.

    MrTLicious on
  • Dis'Dis' Registered User regular
    You'll really need a better specification of your model for people to be able to give input on what you'll need to know; are you doing concentrations of ligands and receptors, or modelling them as individual agents moving about, etc? Some things will require more programming work than others.

    Some points:
    -irrc Matlabs bundled manual is pretty okay and should explain the what
    -There are lots of different numerical analysis software platforms out there, in my experience people use Matlab because the syntax is easier for the non-CS users, and the central control means it has less sprawling options than the open source stuff like R, its more straightforward to make pretty graphs, and the student license is pretty cheap.
    -Your institution should have some sort of introductory course/be willing to send you to one elsewhere. It is really helpful to get to grips with stuff like this with someone actually physically present to give you advice.
    -If you've never used anything like this before, pretty much any book in the library about Matlab will be worth a gander at, at least the first chapter or so ;).

  • alltheolivealltheolive Registered User regular
    Matlab is very general mathematics software. It has some add-ins like Simulink that are primarily graphical, but mostly it's a programming language with lots of special tools for math, including graphing things. I feel its most distinctive strength is in processing data and signals, but I use it for tons of different things, including simulations of various types. It's not very specialized when it comes to, say, 3D visualization, but you can do that too.

    If you are in a PhD program that recommends using Matlab, I think what you want is to talk to someone who's already used it for something similar and ask for their code. If this is a case of "my advisor thinks s/he's heard of of Matlab being a good thing for stuff," Goal One might be to define your problem a bit better and look for a class on numerical methods in your field (or the next closest field) at your school.

    Beyond that it's sort of hard to say- can you program a bit in general? If so, you'll probably find Matlab easy to pick up. If not, well, if you're going to do a PhD with a simulation element, you'd have to learn it anyhow, and Matlab's a pretty gentle place to start- go to the library and get literally any book on Matlab. There are also a lot of people online with sample code for molecular dynamics, fluid dynamics, or integrating differential equations.

    Matlab's great! It's great that you get to learn it as part of your degree; it'll be useful.

  • GdiguyGdiguy San Diego, CARegistered User regular
    At the core, Matlab is just like high level programming languages (Perl/Python/etc), except with a nicer interface. Basically anything you can do in one of those languages you could do in any of the others; the question is how easy it is, and how many toolkits already exist for doing what you want to do. The nice thing about Matlab is that for mathematics / statistics / etc, a lot of things are pre-written - so in addition to standard mathematics commands, you have things like hierarchical clustering, plotting commands, image processing, (some) machine learning algorithms, etc already in the language as set commands instead of something you have to code yourself (or go google searching for a package for). When you run Matlab you have two options - run single commands in a window, or chain a whole bunch of commands into a file (".m files"), and then run the file, which will sequentially step through each command (so you can set up and automate complex analyses and have them run without you having to manually enter every step).

    In general Matlab is designed for dealing with (large) matrices of numerical values. So as a comparison, in something like Perl it's very easy to deal with hashes (arrays of text strings), in Matlab it's much more of a pain to deal with strings; however, it's MUCH easier to do linear algebra / computation with matrices in Matlab (all of which are pre-coded in the language as just a single command) than in something like Perl.

    If you're coming with no experience I'd highly suggest (as everyone else has) to just go find a Matlab tutorial somewhere online and give it a whirl - honestly, there'll be a couple hours of getting the hang of the interface, and once you understand that the important issues are more conceptual than anything else (with the major one being to start thinking about how to formulate your question as a set of data in a vector/matrix, and how to manipulate that matrix to do the calculations you want).

  • RichyRichy Registered User regular
    You're welcome to read my Matlab introduction lecture slides. I give command lists, how-tos, code examples, and point out common mistakes. I'll PM you the URL to my personal website.

    sig.gif
  • CptHamiltonCptHamilton Registered User regular
    It sounds like you're unclear on the actual mathematical modeling aspect of your research, rather than just Matlab?

    If that's the case, I would recommend (as others have) hunting down someone in your department who already does something similar to what you want to do. If they can't explain it to you then they can probably at least point you to the resources they used to learn it.

    You're a PhD candidate, so obviously you're smart. Don't let some modeling frighten you; it's easier than you probably think it will be.

    PSN,Steam,Live | CptHamiltonian
  • Britjade91Britjade91 Registered User regular
    Hi, thanks so much for the input.

    I'm aware my question was vague, and that is exactly my problem - I have NO coding experience. The PhD was only very vaguely set out when I accepted the offer (which was great for adaptability), however it has now been turned in this direction which is new to me!

    So to be more specific, the aim of my course is to look at the changes that occur in Dendritic Cells (of the immune system) when they are activated by their appropriate ligand/target.

    I'm going to need to know abundance of receptor, affinity for the ligand, which ligands are involved and the abundance of the cells themselves.

    I then want to repleace this interaction with nanoparticles which should allow me to induce a larger scale response than would normally be seen, to detect activation and see what changes occur between the inactive and active state, and how many receptor ligand complexes are necessary to make this activation happen.

    I have a book ordered from amazon for Matlab in biosystems, but as my supervisor has given me a two week gap to have a fairly solid grasp of this I thought this would be a good idea for some places to start!

    This is an accurate statement; !)
    It sounds like you're unclear on the actual mathematical modeling aspect of your research, rather than just Matlab? quote] . Give me cells over maths anyday, but I have to learn it sometime!!!

    Unfortunately there are no courses running in my area at the moment, but I will keep looking!

    If there is anything else to add with that extra bit of information that would be great, thanks again!

  • GenlyAiGenlyAi Registered User regular
    edited October 2013
    I'm not sure I get your problem 100%, but my understanding is that you want to take known data about receptor-ligand binding properties, combine it with empirical data on how activation depends on nanoparticle concentration (or ligand density), and use this + modeling to predict how many receptor-ligand complexes are necessary for activation.

    If that's right, I would not focus on Matlab to begin with. The first thing to do is to identify a modeling framework to represent the physical system. If that's not something you can easily do/have already done, perhaps there are publications or collaborators that you can draw on. (This kind of biophysical modeling is very far from my own expertise, so I feel you.) Once that's complete, you can focus on what kind of software you need -- excel may be sufficient!

    All that said, it will never hurt you to know some basic coding. It is so ridiculously easy to learn, and so few biologists make the effort, that it's definitely one of the best ways to stand out from your peers.

    (Hopefully this doesn't come across as condescending. I am just sort of assuming that you have no modeling expertise from your earlier posts, though I'm not sure you actually said that.)

    GenlyAi on
  • shwaipshwaip Registered User regular
    edited October 2013
    First: just get familiar with matlab. You can probably find a quick intro, but I'll go ahead and link this:

    http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-094-introduction-to-matlab-january-iap-2010/index.htm

    There also may be some undergraduate classes being taught at your school that will be helpful (Electrical Engineering in particular).

    Second: I have a few general suggestions that are probably more geared towards coding practice than matlab in particular, but I think they are just as important.

    1) Write your code in small manageable chunks that are easy to test. Don't write out a giant script and try to run it all at once. You'll just be in for headaches.

    A simple example would be: "I'm interested in calculating h( g(x) + f(x))". (where h,g,f are all functions you have to write). You could write a long script to do that all, but really you should write f(x), and test it. Write g(x), test it. Write h(y), test it. Then test h(g(x) + f(x)). This may sound obvious, but always try to break down things into manageable, TESTABLE chunks.

    2) Understand the problem you're trying to solve and how you are going to approach it before you get plugging along in matlab. If you are seeing unexpected behavior, you need to know if: the model is wrong, your math is wrong, your implementation of the model is wrong, or your code is wrong. (or all of the above) Again, this lets you step through troubleshooting, rather than having a huge mess of things to test at once.

    Last:

    The "help" and "doc" commands are your friends. Use them if you're stuck. And make friends with someone more experienced in your lab. Don't bug them a lot, but if you get stuck, don't hesitate to talk to them.

    shwaip on
  • Fuzzy Cumulonimbus CloudFuzzy Cumulonimbus Cloud Registered User regular
    GenlyAi wrote: »
    I'm not sure I get your problem 100%, but my understanding is that you want to take known data about receptor-ligand binding properties, combine it with empirical data on how activation depends on nanoparticle concentration (or ligand density), and use this + modeling to predict how many receptor-ligand complexes are necessary for activation.

    If that's right, I would not focus on Matlab to begin with. The first thing to do is to identify a modeling framework to represent the physical system. If that's not something you can easily do/have already done, perhaps there are publications or collaborators that you can draw on. (This kind of biophysical modeling is very far from my own expertise, so I feel you.) Once that's complete, you can focus on what kind of software you need -- excel may be sufficient!

    All that said, it will never hurt you to know some basic coding. It is so ridiculously easy to learn, and so few biologists make the effort, that it's definitely one of the best ways to stand out from your peers.

    (Hopefully this doesn't come across as condescending. I am just sort of assuming that you have no modeling expertise from your earlier posts, though I'm not sure you actually said that.)
    Yeah, I am not seeing how Matlab is going to help you with this at all.

    Moreover, there are a bunch of geometrical considerations you must take into account to model a sphere binding (with many ligands) to a receptor.

    I would start by clearly defining all your parameters and going from there.

  • KetBraKetBra Dressed Ridiculously Registered User regular
    GenlyAi wrote: »
    I'm not sure I get your problem 100%, but my understanding is that you want to take known data about receptor-ligand binding properties, combine it with empirical data on how activation depends on nanoparticle concentration (or ligand density), and use this + modeling to predict how many receptor-ligand complexes are necessary for activation.

    If that's right, I would not focus on Matlab to begin with. The first thing to do is to identify a modeling framework to represent the physical system. If that's not something you can easily do/have already done, perhaps there are publications or collaborators that you can draw on. (This kind of biophysical modeling is very far from my own expertise, so I feel you.) Once that's complete, you can focus on what kind of software you need -- excel may be sufficient!

    All that said, it will never hurt you to know some basic coding. It is so ridiculously easy to learn, and so few biologists make the effort, that it's definitely one of the best ways to stand out from your peers.

    (Hopefully this doesn't come across as condescending. I am just sort of assuming that you have no modeling expertise from your earlier posts, though I'm not sure you actually said that.)

    Yeah basically this.

    MATLAB is essentially just the means by which you let the computer interpret and produce results for the model you have already constructed.

    KGMvDLc.jpg?1
  • Cowboy-BebopCowboy-Bebop Registered User regular
    edited October 2013
    I'm going to echo what some people have said above me. The first step is to figure out the model, not MATLAB. MATLAB, in this case, is purely a tool to calculate the solution of your model and is going to be the last thing you need. From the way I've read your posts, it really doesn't sound like you should dive head first into trying to learn MATLAB. The software can take you in many different directions and a lot of them will not be useful to you. The real issue is going to be coming up with and understanding the model; coding it in MATLAB, if you can collaborate with someone who knows how to use it, should be a snap.

    As an analogy, the model is the blueprint- it contains (hopefully) all the biological interactions you want to capture. MATLAB is a hammer- you use it after the blueprint is done to bring to life what's in the blueprint.

    There are so many built in features with MATLAB that depending on your model you may be able to solve it in only a few lines of code or just using the PDE toolbox.

    Cowboy-Bebop on
  • Britjade91Britjade91 Registered User regular
    Thanks, I have been looking at my design parameters but I didn't want to put off looking into matlab for so long that, because it was new and unfamiliar, I just started dreading it.

    I will look into my parameters more and keep picking at MatLab as I go, and speak to my supervisor this afternoon. Unfortunately because I am in a Biomed lab, no-one I have asked can provide any help or direction at the moment.

    Thanks again, I'll post an update in a couple of weeks.

  • AustralopitenicoAustralopitenico Registered User regular
    Matlab is easy. I am a dumb biologist and I taught myself enough to do some data analysis routines with just some time and patience.

    There are probably courses you can take, if not, everything is on the internet, just searching for "matlab manual" or "matlab basics" will give you a lot of excellent free pdfs with tutorials and whatnot. This tutorials will familiarize you with Malab and you will discover you are more than capable of handling it. Once you have that, and you know the model you want to use, it's all pretty straightforward.

  • Britjade91Britjade91 Registered User regular
    Matlab is easy. I am a dumb biologist and I taught myself enough to do some data analysis routines with just some time and patience.

    There are probably courses you can take, if not, everything is on the internet, just searching for "matlab manual" or "matlab basics" will give you a lot of excellent free pdfs with tutorials and whatnot. This tutorials will familiarize you with Malab and you will discover you are more than capable of handling it. Once you have that, and you know the model you want to use, it's all pretty straightforward.

    I am getting there, slowly but surely! It's the pace that's bothering me! Can I ask how long it took you to get to grips with it, there abouts!?

    Thanks!

  • majidmajid Registered User new member
    Hi everybody!
    i am almost new in Matlab.
    I am trying to calculate the value af a and a' to satisfy the condition in which a(i+1)-a(i)<1e-5 and same for a';
    i wrote this code but it doesn't work:
    clc;
    clear all;
    % enter design parameters
    z=input('Number of blades=');
    R=input('radius of Rotor =');
    J=input('tip speed ratio=');
    l=input('chord lenght=');
    rr=input('radius position, r/R=');
    beta= input('pitching angle=');
    % initializing
    a=0;
    a_prim=0;
    epsa=1e-5; epsa_prim=1e-5;
    i=0;
    max_iteration=1000;
    tola=20;
    tola_prim=20;
    while (tola > epsa || tola_prim > eps_aprim) && (i < max_iteration)
    i=i+1;
    phi=atand((1-a)/(rr*J*(1+a_prim)));
    alpha=phi-beta;
    Cl=0.1*alpha;
    r=R*rr;
    lambda=z*l*Cl/(8*pi*r);
    a=1/(1+((sin(phi)*tan(phi))/lambda));
    a_prim=1/((cos(phi)/lambda)-1);
    tola=a1-a;
    tola_prim=a_prim1-a_prim;

    end
    would you please help me?
    truly
    Majid

This discussion has been closed.