basic matlab prob

Discussion in 'Programmer's Corner' started by ddonn, Nov 12, 2010.

  1. ddonn

    Thread Starter New Member

    Feb 10, 2010
    13
    0
    Hi,

    I am completely new to matlab. I have been given a simple task to plot a graph(frequency over time) and at the max value of frequency i have to print out the corresponding time value to the command window.

    So far I have plotted the graph with the values im using and got the max value of the frequency. I am trying to use a while loop to get the time value,
    c = max(F)
    while (F == c)

    end;

    Can anyone tell what i need to put between while and end to print the corresponding time value to command screen if time variable is defined as T.

    Thanks in advance
     
  2. guitarguy12387

    Active Member

    Apr 10, 2008
    359
    12
    I am sure there is an easier way to do this... but i can't think right now.

    you should try something like this:

    Code ( (Unknown Language)):
    1.  
    2. for i = 1:length(F)
    3.     if (F(i) == max(F))
    4.         T(i)
    5.     end
    6. end
    7.  
    8.  
    Also, you should use the 'code' tags to keep formatting :)
     
Loading...