How to perform a coordinate transformation in a function?
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kovács
am 23 Dez. 2023
Bearbeitet: Kovács
am 24 Dez. 2023
I want to perform a coordinate transformation on a ds square. I have never used MatLab before. I have entered the original expression, I will enter how the new coordinates depend on the original ones. Here I get stuck: how should I tell it to substitute into the ds square function?
3 Kommentare
John D'Errico
am 24 Dez. 2023
This is not a question about knowing MATLAB, but a question of understanding what a coordinate transform means, and how you would "apply" such a thing.
For example, suppose you have coordinates, (x,y). Then you might wish to convert to polar coordinates. That is a coordinate transform. You can do so by a simple set of equations, or you can use the cart2pol function in MATLAB.
Even more simply, given coordinates (x,y), then the pair (x+1,y+2) is a coordinate transform, a simple translational one.
The problem is, we have no idea what you are doing, what transformation you would employ, or how you would use it in code. I could see cases where you might use the coordinate transform in a purely mathematical way, so before you write any code at all. Or it might become an essential part of your code.
You need to be far more clear if you want a useful answer.
Akzeptierte Antwort
David Goodmanson
am 24 Dez. 2023
Hi Kovacs
Here is one way. Clearly
x^2 + t^2 = xi^2
by inspection, so that factor, which is common to both terms, can be saved till the end.
syms x t xi lam dxi dlam
x = xi*cos(lam)
t = xi*sin(lam)
dx = diff(x,lam)*dlam + diff(x,xi)*dxi
dt = diff(t,lam)*dlam + diff(t,xi)*dxi
ds2 = simplify((1/xi^2)*((-dt^2+dx^2)*(x^2-t^2) +4*x*t*(dx*dt)))
ds2 = - dlam^2*xi^2 + dxi^2
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Special Values finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!