## 30 Reputation

10 years, 349 days
University of Verona

## Thank you...

@_Maxim_
Thank you so much. I implemented the code you shared with me and it works. Thank you so much for helping me out with this problem.
Still I do not understand every line of your code (especially why we need that rotation) but I will get through it. Thanks a lot again.
Cheers
Andrea

## Sorry for the late reply...

@_Maxim_ again, sorry for the late reply.
I will try to amend my script and text you back when done!

Andrea

## I will give it a try...

@_Maxim_ hank you for your kind support.
I will try to implement your code ASAP!

Thank you so much and sorry for the delay with my reply!

Andrea

## Thank you all...

Thank you all for your kind support. I really appreciated every single reply.

However, the problem persists. To avoid confusion, I am posting here the entire main script and the stl files I am loading. In the script there are comments on the critical parts. I think that a MWE is not the best solution, as maybe some relevant parts are omitted. I'M PASTING HERE THE GOOGLE DRIVE LINK TO THE DIRECTORY WHERE THE MALPE CODE AND THE STL FILES ARE STORED.

Thank you so much for helping me. Any contribution is really appreciated.

Andrea

## Equations...

I'm checking equations again. There should be intersection there.

One equation is like f(x,y)=z (plane) and the other is g(x,z)=y (quadric/parabolid). If everything worked during the fitting then the two equations should provide an ellipse.

Andrea

## Equations are indeed correct...

my_quadric equation is in x and z.
There are different surfaces on the bone that I'm fitting. Here the problem is on the inferior surfaces, that compenetrate the planes on the tibial plateau. The frontal surfaces, that compenetrate with the patellar facets are fine. In tat case, both the quadric and the plane are provided by equations like f(x,y)=z and g(x,y)=z. I can then compute the ellipse and the centre.

When the plane and the quadric are given with f(x,y)=z and g(x,z)=y I can't do that. I'm pretty sure that intersection points exist, as I'm sure that the LinearFit does its job correctly.

Andrea

## Surfaces...

@Rouben Rostamian  I'm talking about the original surfaces f(x,y) =z and g(x,z)=y. If I understood correctly, f is a plane and g is a parabolid. But I cannot find the correct centre of the intersecting ellipse.

I do agree with you, but I am sorry, I cannot solve this problem.

Andrea

## You are right...

@Rouben Rostamian  thank you for clarifying that.
Still, those surfaces should intersect and create an ellipse. This ellipse does exist but if I take the coordinates (x,y) of its center point to get z, this point is not where I expect it to be.

Thank you so much for your understanding
Andrea

## Do not have the zcenter...

When I use the function ellipse I got x and y coordinates. Then I use those coordinates in my_plane equation to get the z coord. However, it does not fall into the correct place.
Yes, you are right, I use LinearFit to find those equations, but then I'm using them like z = f(x,y) and y = g(x,z).

Thank you also for your suggestions regarding implicitplot3d. I will play with the number of points.

Andrea

## @Rouben Rostamian  thanks. If ...

@Rouben Rostamian  thanks.

If I try to apply my LinearFit on some points then I get equations like this:
-4416.49480903109+3.42506722068725*x+17.0737866729714*y-0.464079465520700e-1*x^2-0.162556565141789e-1*y^2

and this is like f(x,y) = 0 and I have a parabolid directed with z. Why shouldn't I get the same with my surface -28737.4641541118+.384041954184573*x+114.660353341629*z-0.523267691314821e-1*x^2-.113994873368793*z^2

that is like g(x,z)=0.

In other words I found very difficult to generate equations for parabolid directed with z. I guess that plot3d takes the sequence xyz no matter what. So I cannot plot a parabolid directed with z.

Does it make any sense?

## Thank you so much, still something going...

@Rouben Rostamian  Thank you so much for helping me.

That's amazing how much effort you guys put on my issue.

Still, I do not understand why that quadric equation looks like a cyclinder when it is not. I got it by using the LinearFit of an equation [1,x,z,x^2,y^2] on a matrix of points taken from an stl file. This file contained the coordinates of the surface points of a femur.

Femoral condyles are like quadric parabolids. They are intersecting the tibia plateau (the plane) creating an ellipse. The centre of this ellipse is where the contact forces are acting. But! When I use the equation given by the LinearFit in x and z, I cannot find the right point.

In fact, if I use your mw.mw file taking the coords xc yc and zc it is not where I would expect it to be.

I'm bit confused at the moment. Is that only a problem of visualization or it means that my parabolid is not a parabolid at all? Why is that a cyclinder directed with y? It shouldn't be!

Thank you again guys for your kind support.

## Still plotting the point outside the ell...

@tomleslie thank you so much for the interest in my work.

Ok, I got your point and I tried to iclude those views also in my options. But, still, the centre of the ellipse (red dot) does not appear to be plotted correctly...

Is there anything special to do with coordinates or reference systems for both the equations?
Is that a problem, from your point of view, that one equation is like f(x,y) and the other use x and z?

Thank you so much,

Andrea

## @acer good morning. For example I h...

@acer good morning.

For example I have to multiply: P sin(x(t))cos(x(t)).

If I generate the code I will have: P*sin(x(t))*cos(x(t)).

But, in my Matlab script I should span from t = 0 to t = t_final (I can't run a cycle, I need the closed form). So x(t) is a vector, and so are sin(x(t)) and cos(x(t)), whereas P is a scalar parameter instead.

So I would like to retrieve P*sin(x(t)).*cos(x(t))

Hope this helps

Thank you for helping. I wish you a nice week.

Andrea

## @acer good morning. For example I h...

@acer good morning.

For example I have to multiply: P sin(x(t))cos(x(t)).

If I generate the code I will have: P*sin(x(t))*cos(x(t)).

But, in my Matlab script I should span from t = 0 to t = t_final (I can't run a cycle, I need the closed form). So x(t) is a vector, and so are sin(x(t)) and cos(x(t)), whereas P is a scalar parameter instead.

So I would like to retrieve P*sin(x(t)).*cos(x(t))

Hope this helps

Thank you for helping. I wish you a nice week.

Andrea

## oh gosh. Seems nothing but trivial. I wi...

oh gosh. Seems nothing but trivial. I will try!
Thank you guys.
Maybe Matlab will still work with .* products between parameters or just the Maple still valid with .~ .
In the first case I guess I can find&replace easily in Matlab coding environment.

Anyway thank you again for supporting me.

Thank you so much

Sincerly

Andrea

 1 2 Page 1 of 2
﻿