Iron Edge

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 


* *

Apply to Iron Edge

Apply to the ToT Raid
Currently full
Apply to the Main Raid
Recruiting!
Apply for the Weekend Raid
Recruiting!
Apply as a Social member
All are welcome to apply
 Dat code. Help plx?



0 Members and 1 Guest are viewing this topic.

April 13, 2012, 01:49:40 pm
Read 5593 times

Offline Starbrow

  • Guild Member
  • *

  • 1,234
    Posts

Dat code. Help plx?
« on: April 13, 2012, 01:49:40 pm »
Right, so I'm trying to code a clever way of getting some of my research plotted. What I've got is a bunch of lists that could look like this:

parameter_one = [180; 180; 180; 200; 180; 200; 200; 180];
parameter_two = [200; 261.8; 157.1; 130.9; 78.5; 157.1; 261.8; 392.7];
result_example = [50 40 45 43 52 63 53 57];
result_deviation = [1 2 1 2 1 2 1 2];

Now, I want to plot the results as a function of parameter two, but in sets that are separated by parameter one i.e. first plot all the results that have parameter one set to 180, then plot all the results that have parameter one set to 200 (see sketch). My problem is that I can't seem to find a very effective way of splitting up these lists in a way where I don't hard code the number of unique values of parameter one or two.

Edit: This is in MATLAB, if this matters. I can handle plotting the deviation myself, so don't worry about that.
« Last Edit: April 13, 2012, 01:52:02 pm by Starbrow »
Feral, a class of its own.

Alamo - REMEMBERS- HEEL BARES DURID! BARE DURIDS IS STORNG FREND!

April 13, 2012, 01:57:06 pm
Reply #1

Offline Gaeios(Graxlos)

  • Imperator
  • *

  • 5,082
    Posts

  • Forum Admin and Guild Master

Re: Dat code. Help plx?
« Reply #1 on: April 13, 2012, 01:57:06 pm »
Ok Im not at all sure I understans what you want but it seems you want a loop for all unique values of parameter one, as outer loop.
then for each you want a loop with all the values of the given number right?

Bears like alts!


April 13, 2012, 02:08:57 pm
Reply #2

Offline Starbrow

  • Guild Member
  • *

  • 1,234
    Posts

Re: Dat code. Help plx?
« Reply #2 on: April 13, 2012, 02:08:57 pm »
Right, I guess the lines are actually a bit misleading. I'll try a better drawing:
Feral, a class of its own.

Alamo - REMEMBERS- HEEL BARES DURID! BARE DURIDS IS STORNG FREND!

April 13, 2012, 02:47:29 pm
Reply #3

Offline Gaeios(Graxlos)

  • Imperator
  • *

  • 5,082
    Posts

  • Forum Admin and Guild Master

Re: Dat code. Help plx?
« Reply #3 on: April 13, 2012, 02:47:29 pm »
make a number of arrays based on amount of unique values. take the y values from the corresponding places in the result array.
then plot the new arrays.

Bears like alts!


April 13, 2012, 05:27:26 pm
Reply #4

Offline Starbrow

  • Guild Member
  • *

  • 1,234
    Posts

Re: Dat code. Help plx?
« Reply #4 on: April 13, 2012, 05:27:26 pm »
My eventual solution (temperatures is the same as parameter_one, res_times is parameter_two, while full_FWHM is results):

% The unique temperatures are found and sorted after size
b = unique(temperatures);
% Finds the number of different temperatures used
c = size(b,1);
map = colormap(jet(c)); % Creates c different colours on the jet scale
i = 1; % Running integer needed in the if-loop
k = 1; % Running integer needed in the while-loop
% Loop then plots the points
while k < size(res_times,1)+1
    % First, we figure out which temperature index the point to be plotted
    % corresponds to

    eval_temp = temperatures(k);
    if eval_temp == b(i)
        % If the temperature is equal to the i'th unique value in the
        % temperature array, the point is plotted using the i'th color in
        % the colorlist map

        p = plot(res_times(k),full_FWHM(k),'o','MarkerFaceColor',...
            map(i,:),'MarkerSize',6,'MarkerEdgeColor','k');
        % The next few lines are merely to make sure the point is removed from the
        % legend

        hAnnotation = get(p,'Annotation');
        hLegendEntry = get(hAnnotation,'LegendInformation');
        set(hLegendEntry,'IconDisplayStyle','off')
        % Since we have found a match, we need to reset the index and
        % increase the loop value by one

        i = 1;
        k = k+1;
    else
        % If the temperature evaluated is not equal to the i'th unique
        % temperature, the index i is increased by one, and we try again

        i = i+1;
    end
end
Feral, a class of its own.

Alamo - REMEMBERS- HEEL BARES DURID! BARE DURIDS IS STORNG FREND!

 

Iron Edge Discord

Recent

Recent Logs

Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 03:21:28 pm

Login with username, password and session length

386 Guests, 0 Users