Find Y of the equation

2 Ansichten (letzte 30 Tage)
Marc Martinez Maestre
Marc Martinez Maestre am 16 Sep. 2020
Kommentiert: Image Analyst am 23 Sep. 2020
Hey everyone,
I have a problem finding the image (y) of the equations for an specific x. I build the following "wave" that it is build with f parts of 6m per each. The first part it has two equaitons while the rest have three different funcitons per each. Every function follows teh expression a*x^2+b*x+c and I have a vector of nx3 were every column corresponds to the terms of the parabolic expression. I have performed the code for the first and last sections, but the ones in the middle I have trouble. The distribution is as follows:
-The first curve of the section, starts at the previous section, prolongates until x=L(previous section)+0.1*L(current section)
-Second curve of the current section reaches the point 0.9*L(current section)/2
-Third curve of the current section starts at 0.9*L(current section)/2 and ends at 0.9*L(current section)
The main objective is to determine the y for every x. We will enter an x, lets say for every 2m, and we have to determine the y of the equation for every 2m.
The code to determine the y I have started is the following:
y_plot=[0.246913580246914 -1.33333333333333 2.10000000000000;
-1.66666666666667 20 -57.3000000000000;
0.408163265306122 -7.10204081632653 31.1938775510204;
0.246913580246914 -4.29629629629630 18.9888888888889;
-1.66666666666667 40 -237.300000000000;
0.408163265306122 -12 88.5000000000000;
0.246913580246914 -7.25925925925926 53.6555555555556;
-1.66666666666667 60 -537.300000000000;
0.408163265306122 -16.8979591836735 175.193877551020;
0.246913580246914 -10.2222222222222 106.100000000000;
-1.66666666666667 80 -957.300000000000;
0.408163265306122 -21.7959183673469 291.275510204082;
0.246913580246914 -13.1851851851852 176.322222222222;
-1.66666666666667 100 -1497.30000000000] %coeficients of a (first column), b(second column) and c(third column)
x_div=2 %find y every 2 meters
L=[6,6,6,6,6] %beam formed by 5 sections of 6meters each
position=L(:,1);+0.1*L(:,curve)
contador_vector=1
points_x=[]
points_y=[]
for curve=2:1:(n-1) %for everysection except the first one and the last one
for position=position:x_div:position+(0.9*L(:,curve)/2) % first equation of the current section
if position<sum(L)
eq=y_plot(curve*2+contador_vector-2,1)*x^2+y_plot(curve*2+contador_vector-2,2)*x+y_plot(curve*2+contador_vector-2,3);
points_x=[points_x,position];
points_y=double([points_y,subs(eq,x,position)]);
else
end
end
for position=position:x_div:position+0.9*L(:,curve)
if position<sum(L)
eq=y_plot(curve*2+contador_vector-1,1)*x^2+y_plot(curve*2+contador_vector-1,2)*x+y_plot(curve*2+contador_vector-1,3);
points_x=[points_x,position];
points_y=double([points_y,subs(eq,x,position)]);
else
end
end
for position=position:x_div:(position+L(:,curve)+0.1*L(:,curve)-0.1*(L(:,curve)-L(:,curve+1)))
if position<sum(L)
eq=y_plot(curve*2+contador_vector,1)*x^2+y_plot(curve*2+contador_vector,2)*x+y_plot(curve*2+contador_vector,3);
points_x=[points_x,position];
points_y=double([points_y,subs(eq,x,position)]);
else
end
end
position=position+x_div;
contador_vector=contador_vector+1;
end
%
points_x'
points_y'
  2 Kommentare
Marc Martinez Maestre
Marc Martinez Maestre am 16 Sep. 2020
So, the loop showld find x points between 6 and 24, but it reaches 74. The main problem is how to tell matlab that:
For every one of the sections I want that the first curve that it goes between x and x2 find the y for the current position. While this position increases by 2. And if the position is bigger than x2, check in the next function. And all this funcitons are inside a vector taht contains the coefficients of the paraolic expresssion.
Image Analyst
Image Analyst am 23 Sep. 2020
Not sure what "the image (y) of the equations" is. Can you post that image?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by