Draw a square with one line?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
Is it possible to draw a square with one line?
What I mean is I got a line that I know, lets say x=[0,0], y=[0,1]; and I want to make a square with that line. In real life if I want a square I need only one line and I will make it because I know other lines are the same length.
The thing I am looking for is that I got a different X and Y data. I mean I got an exponential line so when the Y=1 my X is (lets say) 0.2412.
So I want to know when my Y= 2 what will be my X? DON'T FORGET THAT LINE IS EXPONENTIAL so if Y=1 and X=0.2412 then Y=2 is NOT X=2*(0.2412)
Thats why I want to make a square and guess the X data when I know the Y.
On the picture below is my problem. I want to know what is the X value when my Y is known ( the "+" on 0.025X).
The line from y=0 to y="+" is have to fall down and the tip of the line is my X searching value!!!!
THANK YOU A LOT!
5 个评论
回答(1 个)
Mara
2020-6-18
Not sure I have understood your problem. I think you want to find out x by drawing an orthogonal line from the y-axis, but I do not understand why because you seem to have the x data and the exponential function already.
I will try to answer to 2 possible problems
1.
You know your exponential function, then you can calculate x.
Let's say your exponential function is y = 4^x. Let's say y is 50.
With the above information, you're ready to try solving for an exponent in an equation.
If you take the log to the base 10 of each side and omit explicit identification of the base, this becomes log 50 = log 4x.
log 50 = x log 4, or x = (log 50)/(log 4).
2.
You don't know your exponential function, but if you have plotted the result, you must have the x and y data somewhere.
So you can find it by indexing into the vectors that you plotted with. Let's again say you want the x value where y is 50.
plot(x, y);
y_index = find(y==50); % find the index in the ydata where y is 50
x_value = x(y_index); % index into the xdata
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!