MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by aditya chittipeddi on 22 May 2013

Im doing a project and in that i came across a situation where i have to predict/draw the graph

** a20**=[0.048332 4.591866 9.473681 15.321958 19.962203 24.602355 29.870829 35.139303 39.827975 43.694854 49.108419 54.667355 59.839772 63.803829 69.266568 74.729587 79.854512 84.737821 90.057151 96.102356 99.875466]

** vel20**=[0.00016 0.978174 1.789824 1.936022 3.079598 3.892049 4.702419 5.512789 6.987331 7.967905 9.108921 11.57396 14.536968 17.338414 21.459402 26.573768 32.517068 38.626732 48.377339 61.271242 72.517036]

** a10**=[0.338654 4.54365 9.957192 14.8391 20.059382 25.231238 29.823197 35.236903 39.974 45.726219 50.753592 55.684393 59.793775 63.419693 69.222394 74.977463 79.814589 83.926775 89.201323 95.348518 99.802348]

** vel10**=[1.15782 1.392241 2.450475 3.593251 4.90047 5.876723 7.186023 8.823727 10.629235 12.928071 15.725996 18.855367 22.815274 26.280092 36.194662 48.592835 62.318553 76.212234 98.545783 130.313537 155.961065]

for some ** k=20** i know

for some ** k=10** i know

now for some ** k=17.9** i wanna know the

is it possible....can any one help me out plz...

*No products are associated with this question.*

Answer by José-Luis on 23 May 2013

Accepted answer

You could interpolate linearly between the two curves:

a20=[0.048332 4.591866 9.473681 15.321958 19.962203 24.602355 29.870829 35.139303 39.827975 43.694854 49.108419 54.667355 59.839772 63.803829 69.266568 74.729587 79.854512 84.737821 90.057151 96.102356 99.875466];

vel20=[0.00016 0.978174 1.789824 1.936022 3.079598 3.892049 4.702419 5.512789 6.987331 7.967905 9.108921 11.57396 14.536968 17.338414 21.459402 26.573768 32.517068 38.626732 48.377339 61.271242 72.517036];

a10=[0.338654 4.54365 9.957192 14.8391 20.059382 25.231238 29.823197 35.236903 39.974 45.726219 50.753592 55.684393 59.793775 63.419693 69.222394 74.977463 79.814589 83.926775 89.201323 95.348518 99.802348];

vel10=[1.15782 1.392241 2.450475 3.593251 4.90047 5.876723 7.186023 8.823727 10.629235 12.928071 15.725996 18.855367 22.815274 26.280092 36.194662 48.592835 62.318553 76.212234 98.545783 130.313537 155.961065];

plot(a10,vel10,'b-'); hold on plot(a20,vel20,'g-'); minX = min([a10 a20]); maxX = max([a10,a20]); xx = linspace(minX,maxX,100); vel10_inter = interp1(a10,vel10,xx); vel20_inter = interp1(a20,vel20,xx); val = 17.6; % change here interpVel = vel10_inter + ((val-10).*(vel20_inter-vel10_inter))./(20-10); plot(xx,interpVel,'r-');

aditya chittipeddi on 23 Jun 2013

I have one more doubt..instead of data if i have 2 equations can i predit other equation basing on these two(same family of curves)

Linear model Poly8:

For some K=5

f(x) = 2.029*x^8 + 3.479*x^7 -4.416*x^6 -6.172*x^5 + 7.078*x^4 + 8.836*x^3 + 7.588*x^2 + 19.4*x + 18.38

For some K=20

f(x) = -0.3004*x^8 + 0.4388*x^7 + 1.98*x^6 -1.399*x^5 -2.994 *x^4 +4.91*x^3 + 9.877*x^2 + 11.5*x + 9.608

Now can i predict the equation for some K=10 r for K=12.7?(K is a constant for the particular experiment between x and y)

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76593#comment_150263

Hi Aditya, I think mathematically, this problem can't be resolved. With only one independent variable, you can't have a dependent variable as a curve.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76593#comment_150338

Thanks very much for the reply...

X and Y both may b dependent on T but Y is at the same time dependent on X say Y=f(X)

I mean..to put it simply

i have set a parameter(T)=5 that effects both x and y..i take plot of X Vs Y now i set the parameter(T)=10 and i get plot of X Vs Y again

Now i want X Vs Y at say (T)=7.2 r for some other value

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76593#comment_150501

T in last comment is

in the original post? If so, my comment still applies to your question...k