Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we have two sets of ( x , y ) coordinates represented by a matrix S of size M x 2 and a row

Suppose we have two sets of (x,y) coordinates represented by a matrix S of size M x 2 and a row vector T of size 1 x 2. The goal is to find the Euclidian distance between each of the M points in S with the (single) point in T. The result should be a column vector D of size M x 1. Give Matlab code that performs this calculation without using the builtin Matlab functions "dist", "pdist", or "pdist2" and without using loops
For example, suppose
S =[21; 32; 52];
T =[32];
Your code should produce the answer:
1.4142
0
2.0000
Alternatively, suppose
S =[21; 32; 52; 44];
T =[32];
Your code should produce the answer:
1.4142
0
2.0000
2.2361
In other words, your code should work with any number of rows (M) for matrix S and the value of M should not be "hard coded"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions