Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 8th, 2003, 08:50 AM
Kohokoho Kohokoho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Kohokoho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Identifying Local Maximas in a plot

Does anyone know of an algorithm to identify Local maximas in a plot? (in VB). Any advice on it be helpful.

Reply With Quote
  #2  
Old December 8th, 2003, 09:10 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,174 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 27 m 59 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
wow - I'm sorry, but no. Can you tell me what a local maxima is? It would seem that if you have any algorithm for it, then it should apply to any object oriented language - it's just a matter of writing the necessary classes to implement that algorithm. Do you have an algorithm or equation for it at all?
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old December 8th, 2003, 09:26 AM
Kohokoho Kohokoho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Kohokoho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Fisherman,

You're right. I still need to develop an algorithm for it first and this forum may not be the right place to search for algorithm itself. Do u know of any site or forum where I can get help from in the algorithm itself?

I admit I should have done more searches online before posting my question here.

Local maxima, as you may think, are smaller peaks (other than the highest peak) in a plot.


Thanks.

Reply With Quote
  #4  
Old December 8th, 2003, 10:04 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,174 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 27 m 59 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
wow - 2 years of calculus right out the window! I remember now, but I don't know of any way to find them, short of doing a bubble sort within a desired range (maybe of an array). Probably the best way to do it would be to not think of it as a graph, but instead as a dataset. How will you be determining which range you want the local maximum of?

Reply With Quote
  #5  
Old December 8th, 2003, 10:22 AM
Kohokoho Kohokoho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Kohokoho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You're right again when u say I need to think of it as a dataset. From my limited knowledge, Bubble sort compares consecutive values and swaps them until they appear the way we want; The algorithm will certainly need to compare the data values close to each other to find the maximum (local ); but I am not sure if there's a need to swap them coz all it needs to do is identify and record the local maxima.

I have a set of conditions which will already provide me with the data range I am interested in...I just need to get the algorithm

any ideas that pop into your mind?

Reply With Quote
  #6  
Old December 8th, 2003, 11:39 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,174 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 27 m 59 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well, I wrote a simple little helper function for a dll of common functions that I use at work - it fairly simple, but if you know the values that you want to compare, it works..

Code:
Public Function Max(FirstValue As Variant, secondvalue As Variant) As Variant
    If FirstValue > secondvalue Then
        Max = FirstValue
    Else
        Max = secondvalue
    End If
End Function

'YOU CAN CALL IT RECURSIVELY LIKE SO
dim intMax as integer
intmax = Max(max(max(4,5),(1,2),9),3)
'like any good function  - you can call it in a loop with an array, too

I don't know if that will help you or not, but I've used it several times. It doesn't matter what order the numbers are in, it will still find the max - it also works on characters (though you don't really need it for that) - if nothing else, maybe it will put you on a track towards your goal

Last edited by Fisherman : December 8th, 2003 at 11:42 AM.

Reply With Quote
  #7  
Old December 8th, 2003, 01:30 PM
Kohokoho Kohokoho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Kohokoho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hey fisherman,

I just uploaded a gif file in a new thread in which I have shown the local maxima. From what I can tell from your code, it will be able to identify the middle peak and may miss the other two peaks on the sides. Am I correct? If yes, is it possible to modify the codes so that it catches all the peaks and not just the highest value in a dataset?

Thanks alot for your untiring efforts! I owe you one

Reply With Quote
  #8  
Old December 8th, 2003, 01:48 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,174 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 27 m 59 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
I see what you mean now, the code I wrote could most likely be modified for the functionality you want, but I think it would be easier to simply declare another array, set the second array=to your original one, and use the bubble sort to order the array according to your measure of magnitude. Then, you can just pull the first three (or four or five or etc...) items from that array.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Identifying Local Maximas in a plot


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway