How to rotate a parabola drawn along with the reference line?
I have an equation of calculating the radius of parabola for drawing specific maps. However, I could only draw parabola at origin.
For instance. I want to draw the parabola between two points at some known distance. In the code below, I have used the equation to plot the parabola when the line is horizontal and starts at original. For finding the xy coordinates, I use the cosine and sine components and then plot.
However, in cases where I have the same distance between the points but not at origin (I tried xy coordinates with same magnitude but different location and rotation), I cannot construct the rotated parabola. Is there a way to draw the rotated parabola?
Additionally, my way is inspired from `excel` and is very unituitive. Is there a more convenient way to construct parabola in Matlab?
clc
clear all
close all
%% Input values
D = 250; % mm distance
c = 4; % mm/s velocity
del = 10; % a constant
theta = deg2rad(0:5:360); % a variable
for i = 1:length(theta)
angle = theta(i);
R(i) = 1/2*(D*D – del*del*c*c)/(del*c + D*cos(angle)); % Equation of radius of parabola
x1(i) = 0;
y1(i) = 0;
x2(i) = R(i)*cos(angle);
y2(i) = R(i)*sin(angle);
end
pta = [0 250];
ptb = [0 0];
figure
tiledlayout(2,1)
nexttile
hold on
plot(pta,ptb,’-o’);
plot(x2,y2,’.r’)
xlim([0 D])
nexttile
hold on
ptc = [50 250];
ptd = [40 190];
plot(ptc,ptd,’-o’);
xlim([0 250])
ylim([0 250])
There may be a simple solution, forgive my trignomatry skills and I will appreciate your help in this regard.
All the best.I have an equation of calculating the radius of parabola for drawing specific maps. However, I could only draw parabola at origin.
For instance. I want to draw the parabola between two points at some known distance. In the code below, I have used the equation to plot the parabola when the line is horizontal and starts at original. For finding the xy coordinates, I use the cosine and sine components and then plot.
However, in cases where I have the same distance between the points but not at origin (I tried xy coordinates with same magnitude but different location and rotation), I cannot construct the rotated parabola. Is there a way to draw the rotated parabola?
Additionally, my way is inspired from `excel` and is very unituitive. Is there a more convenient way to construct parabola in Matlab?
clc
clear all
close all
%% Input values
D = 250; % mm distance
c = 4; % mm/s velocity
del = 10; % a constant
theta = deg2rad(0:5:360); % a variable
for i = 1:length(theta)
angle = theta(i);
R(i) = 1/2*(D*D – del*del*c*c)/(del*c + D*cos(angle)); % Equation of radius of parabola
x1(i) = 0;
y1(i) = 0;
x2(i) = R(i)*cos(angle);
y2(i) = R(i)*sin(angle);
end
pta = [0 250];
ptb = [0 0];
figure
tiledlayout(2,1)
nexttile
hold on
plot(pta,ptb,’-o’);
plot(x2,y2,’.r’)
xlim([0 D])
nexttile
hold on
ptc = [50 250];
ptd = [40 190];
plot(ptc,ptd,’-o’);
xlim([0 250])
ylim([0 250])
There may be a simple solution, forgive my trignomatry skills and I will appreciate your help in this regard.
All the best. I have an equation of calculating the radius of parabola for drawing specific maps. However, I could only draw parabola at origin.
For instance. I want to draw the parabola between two points at some known distance. In the code below, I have used the equation to plot the parabola when the line is horizontal and starts at original. For finding the xy coordinates, I use the cosine and sine components and then plot.
However, in cases where I have the same distance between the points but not at origin (I tried xy coordinates with same magnitude but different location and rotation), I cannot construct the rotated parabola. Is there a way to draw the rotated parabola?
Additionally, my way is inspired from `excel` and is very unituitive. Is there a more convenient way to construct parabola in Matlab?
clc
clear all
close all
%% Input values
D = 250; % mm distance
c = 4; % mm/s velocity
del = 10; % a constant
theta = deg2rad(0:5:360); % a variable
for i = 1:length(theta)
angle = theta(i);
R(i) = 1/2*(D*D – del*del*c*c)/(del*c + D*cos(angle)); % Equation of radius of parabola
x1(i) = 0;
y1(i) = 0;
x2(i) = R(i)*cos(angle);
y2(i) = R(i)*sin(angle);
end
pta = [0 250];
ptb = [0 0];
figure
tiledlayout(2,1)
nexttile
hold on
plot(pta,ptb,’-o’);
plot(x2,y2,’.r’)
xlim([0 D])
nexttile
hold on
ptc = [50 250];
ptd = [40 190];
plot(ptc,ptd,’-o’);
xlim([0 250])
ylim([0 250])
There may be a simple solution, forgive my trignomatry skills and I will appreciate your help in this regard.
All the best. parabol, transformation, rotation, translation MATLAB Answers — New Questions