Borrar filtros
Borrar filtros

I tried this code but it doesn't work. Anyone can ans.it?Please.

1 visualización (últimos 30 días)
Gemalyn Apostol
Gemalyn Apostol el 17 de Oct. de 2016
Editada: Gemalyn Apostol el 25 de Oct. de 2016
Given A = [ 1 120; 1 130; 2 140; 3 180; 3 160 ] B = [ 1 91; 2 92; 3 93 ]
The first column in data A and B describe a key for the data. Now i want to "merge" the two data sets so that the result looks like targetdata = [ 1 120 91; 1 130 91; 2 140 92; 3 180 92; 3 160 93 ]
%Let be given three points A, B, C in the Euclidean plane. Determine the fourth point D on the line BC so that AD is orthogonal to BC.
i tried this code but it doesn't work.
cidx = bsxfun(@eq,DataA(:,1),DataB(:,1)');
m = 1:size(cidx,2)
DataA(cidx(:,m),3) = DataB(m,2);

Respuestas (1)

Guillaume
Guillaume el 17 de Oct. de 2016
This seems to be two completely different problems in the same question. I don't see how the first part (creating datatarget) relates to the second part (a geometry problem).
As this is homework, I won't give you the complete solution. Creating datatarget is trivial (just one line) using ismember
As for the geometry problem, this is also easy using vector projection.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by