TutorMe homepage
Subjects
PRICING
COURSES
Start Free Trial
Aahitagni M.
Tutor Satisfaction Guarantee
MATLAB
TutorMe
Question:

Given a set of 3D points with coordinates given by column vectors x, y and z, write a MATLAB function that outputs the minimum distance to the origin.

Aahitagni M.

function d = minDistance(x, y, z) nPoints = length(x) d = zeros(nPoints, 1) %Preallocate for k = 1:nPoints %compute distance for every point d(k) = sqrt(x(k)^2 + y(k)^2 + z(k)^2); end d = min(d) %get minimum distance

Computer Science (General)
TutorMe
Question:

The cache access time of a system is $$10$$ ns and memory access time of the same system is $$110$$ ns. The time to check the cache is included in memory access time. The effective access time is 10% greater than the cache access time. Find the hit ratio for the system.

Aahitagni M.

Let the hit ratio be $$H$$. Effective Access Time = $$H \times T_{cache} + (1-H) \times T_{memory}$$ $$1.1 \times T_{cache} = H \times T_{cache} + (1-H) \times T_{memory}$$ $$1.1 \times 10 = H \times 10 + (1-H) \times 110$$ $$11 = H \times 10 + 110 – 110 \times H$$ $$-99 = -100 \times H$$ $$H = \frac{99}{100}$$ So, the hit ratio of the system is $$\frac{99}{100}$$.

Statistics
TutorMe
Question:

For families with $$n$$ children, the events $$A$$: ‘the family has children of both genders’ and $$B$$: ‘there is at most one girl’ are independent. What is the value of $$n$$?

Aahitagni M.

If event $$A$$ has to be true, $$n$$ needs to be $$>1$$. Let $$G$$ be the number of girls. We have, $$P(A) = P(1 ≤ G ≤ n − 1)$$ $$P(B) = P(G ≤ 1)$$ $$P(A ∩ B) = P(G = 1)$$. Now, $$G$$ varies as $$G ∼ Bin(n, 0.5)$$. So, $$P(A) = 1-P(G=0)-P(G=n) = 1-(\frac{2}{2^n})$$ $$P(B) = P(G=0)+P(G=1) = \frac{n+1}{2^n}$$ Since $$A$$ and $$B$$ are independent, $$P(A)P(B) = P(A ∩ B)$$. So, $((\frac{n+1}{2^n})(1-\frac{2}{2^n}) = (\frac{n}{2^n})$) $(⇔(n+1)(1-\frac{2}{2^n})=n$) $(⇔n+1 - \frac{n+1}{2^{n-1}}=n$) $(⇔{2^{n-1}}=n+1$) Using simple integers for trial and error, we find that $$n=3$$

Send a message explaining your
needs and Aahitagni will reply soon.
Contact Aahitagni