Changing the unknown variable in a matlab line
Afficher commentaires plus anciens
I have the following line in matlab:
y=sum(bin(xout>xout(1) & xout < -lim));
In the above line, Iam computing the value 'y' from known row-vectors 'bin' , 'xout', and known value 'lim'
How can I write the above equation, if I want to compute the value 'lim' if the value 'y' and row-vectors 'bin', 'xout' are now known.
%%---- Following scenario ---%% PICTURE ADDED
Please help
6 commentaires
Image Analyst
le 16 Août 2012
Now known, or not known or unknown?
Azzi Abdelmalek
le 16 Août 2012
what is the lengtht of bin and xout, are they big?
Andrei Bobrov
le 16 Août 2012
Modifié(e) : Andrei Bobrov
le 16 Août 2012
xout was sorted?
zozo
le 16 Août 2012
Azzi Abdelmalek
le 16 Août 2012
do you mean bin(1x6000) and xout(1x200)? because with bin(1x200) and xout(1x6000).
y=sum(bin(xout>xout(1) & xout < -lim));
don't work
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 16 Août 2012
How about (untested)
% Get area as function of xout.
cumulativeSum = cumsum(bin);
% For a given area, called desiredArea,
% find the index where the cumulative sum first exceeds that area.
lim = find(cumulativeSum >= desiredArea, 1, 'first');
% lim was the index. Now find the xout value at that index:
xOutValue = xout(lim);
1 commentaire
zozo
le 16 Août 2012
Catégories
En savoir plus sur Construction dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!