Info
此问题已关闭。 请重新打开它进行编辑或回答。
Taking unlimited set of points between (0,0) and (255,255) , creating a linear equation for each 2, and creating the plot according to those unlimited options
1 次查看(过去 30 天)
显示 更早的评论
I've made a program that reads from the user a set of unlimited unique points. now i have to get linear equation of each following points ( by x ) and plot one graph using different equations for different X's
An example? sure. lets say I have 3 points: (0,0) (50,100) (200,200) I find the first equation y=2x and the second equation is y=(2/3)x + (200/3)
the first one is from 0 to 50 second one is from 50 to 200 how can i plot one graph that will show this exact function? but for many more functions ---from 0 to 50 =2x y= ---from 50 to 200 = (2/3)x+(200/3) ---from 200 to 201 = ... etc
Not sure how do you call it in english so search results was poor.
thanks
0 个评论
回答(1 个)
Tejas M U
2014-7-2
One way you could do this is by finding the linear relation between two points, then creating a matrix for x, and then multiplying the matrix directly with the slope value and adding the intercept. For example, x=0:1:50 x=2*x plot(x,y) hold % this will hold the plot for you so that you can continue plotting
So, you are next iteration would compute the new linear relation X=50:1:200 y=2/3*x + 200/3 plot(x,y) hold % this will hold the plot for you so that you can continue plotting
[Interpolation may be the word, may be]
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!