SCRIPT error using convhull command

Hi, would anyone please help me to correct that error or find a way to plot curves to follow both edges of data (up and bottom of set of data),my script :
nsamples=1000;
for i=1:nsamples
CS(i)=C(1,i);
phi(i)=((14.1477*CS(i)*CS(i))-(28.512*CS(i)) +16.4557);
end
k = convhull( CS(i), phi(i));
plot( CS(K), phi(K),'r0',CS,phi,'b+')
grid on
xlabel('cohesion (kg/cm^2)'),ylabel('phi(degree)')
[ cs values must first call from a random numb. generator.then plotting set of cs vs phi on a x-y area...then need to plot curves to follow both edges of data ] and the errors :
??? Error using ==> cgprechecks at 47 Not enough unique points specified.
Error in ==> convhulln at 42 cgprechecks(x, nargin, cg_opt);
Error in ==> convhull at 42 [k,v] = convhulln([x(:) y(:)]);
Error in ==> pltcphi2 at 6 k = convhull( CS(i), phi(i));

Antworten (1)

Jan
Jan am 27 Okt. 2011

0 Stimmen

This calls CONVHULL with two scalars:
k = convhull(CS(i), phi(i))
Of course it is hard to find a hull for this. Do you mean:
k = convhull(CS, phi)
?

5 Kommentare

milad babaei
milad babaei am 28 Okt. 2011
WOULD you please tell me how can i use this command (convhull)?
using this k = convhull(CS, phi) ...facing this error :
??? Undefined function or variable 'K'.
Error in ==> pltcphi2 at 7
plot( CS(K), phi(K),'r0',CS,phi,'b+')
what can i do to solve that??
Walter Roberson
Walter Roberson am 28 Okt. 2011
For one thing, you could be consistent about whether you use lower-case 'k' or upper-case 'K'.
Jan
Jan am 28 Okt. 2011
The explanations shown by "help convhull" and "doc convhull" are very good already. And if you programm reachs the PLOT command, the CONVHULL must have been successful.
milad babaei
milad babaei am 28 Okt. 2011
ABOVE error appear when using CONvHULL....don't know how solve it??
Jan
Jan am 28 Okt. 2011
Which one is the "ABOVE error"? The "??? Undefined function or variable 'K'" error appears in the line *after* the CONVHULL. This looks like CONVHULL has been processed successfully.
If you want more help, it would be necessary to explain, if my idea of changing "CS(i)" to "CS" had any effects.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 27 Okt. 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by