How can i delate the same values in a vector ?
Mostrar comentarios más antiguos
Hi
To find the zeros of the following equation, i have done the following program but sometimes it displays a repeated solution. So i want to do a program that delate the same solutions to obtain a vector that content the different solutions.
f = @(x) cos(x) * cosh(x) + 1;
for i= 1:40
k(i)= fzero (f, i)
end
Respuestas (1)
the cyclist
el 20 de En. de 2017
Do you mean you want
unique_k = unique(k)
?
9 comentarios
Mallouli Marwa
el 20 de En. de 2017
the cyclist
el 21 de En. de 2017
You could assign back to k:
k = unique(k)
to "get rid of the duplicates". Is that what you mean?
Image Analyst
el 21 de En. de 2017
Try this:
f = @(x) cos(x) * cosh(x) + 1;
for i= 1:40
% Get root for just this value of i.
iRoots(i) = fzero (f, i);
end
% Throw out duplicates.
uniqueRoots = unique(iRoots)
Mallouli Marwa
el 21 de En. de 2017
Mallouli Marwa
el 21 de En. de 2017
Stephen23
el 21 de En. de 2017
Mallouli Marwa
el 21 de En. de 2017
Categorías
Más información sobre Downloads en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!