1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

[Matlab] Help on a homework problem

Discussion in 'BBS Hangout' started by jasonemilio, Jun 12, 2010.

  1. jasonemilio

    jasonemilio Member

    Joined:
    Oct 2, 2007
    Messages:
    4,404
    Likes Received:
    48
    Anyone here ever had to use Matlab before and is good with it?

    Anyways, here's a "homework" problem that I need help with, and any advice is good (or better yet, type out the code for me ;)


    Thanks ahead of time
     
  2. Juxtaposed Jolt

    Joined:
    Apr 5, 2010
    Messages:
    20,828
    Likes Received:
    16,639
    Are you a Texas A&M student?

    I can't help you this problem, but a good buddy of mine is a junior MechEn, and he complains about Matlab a lot. :)
     
  3. ItsMyFault

    ItsMyFault Member

    Joined:
    Jan 28, 2009
    Messages:
    15,646
    Likes Received:
    978
    Read sig.
     
  4. Depressio

    Depressio Member

    Joined:
    Mar 3, 2009
    Messages:
    6,416
    Likes Received:
    366
    Bored, never done any Matlab programming, but...

    Using: http://www.math.utah.edu/~wright/misc/matlab/programmingintro.html

    Code:
    clear
    
    WATER_TEMP = 100;
    COPPER_TEMP = 1187;
    SILVER_TEMP = 2193;
    GOLD_TEMP = 2660;
    THRESHOLD = 0.05;
    
    N = input('Substance temperature: ');
    
    if N >= WATER_TEMP*(1-THRESHOLD) & N <= WATER_TEMP*(1+THRESHOLD)
    
      'The substance is probably water.'
    
    end
    
    if N >= COPPER_TEMP*(1-THRESHOLD) & N <= COPPER_TEMP*(1+THRESHOLD)
    
      'The substance is probably copper.'
    
    end
    
    if N >= SILVER_TEMP*(1-THRESHOLD) & N <= SILVER_TEMP*(1+THRESHOLD)
    
      'The substance is probably silver.'
    
    end
    
    if N >= GOLD_TEMP*(1-THRESHOLD) & N <= GOLD_TEMP*(1+THRESHOLD)
    
      'The substance is probably gold.'
    
    end
    
    if N = 69
    
      'CLUTCHFANS > YOU'
    
    end
    Something like that?!
     
    #4 Depressio, Jun 12, 2010
    Last edited: Jun 12, 2010
  5. jasonemilio

    jasonemilio Member

    Joined:
    Oct 2, 2007
    Messages:
    4,404
    Likes Received:
    48
    Thanks! I think that willl work..........and nice little addition there at the end ;)
     
  6. Ramathorn006

    Ramathorn006 Member

    Joined:
    Nov 9, 2009
    Messages:
    2,725
    Likes Received:
    164
    what class is this for?
     

Share This Page