MATLAB Answers

Finding X value for a corresponding Y value from contents of a table

3 views (last 30 days)
Deepa Maheshvare
Deepa Maheshvare on 13 Jan 2020
Commented: Walter Roberson on 14 Jan 2020
I'd like to find values from the following table.
0 3.0000 1.0000 1.0000 1.0000 1.0000 1.0000
0.0010 3.0000 1.6532 1.1366 1.0207 1.0025 1.0005
0.0020 3.0000 1.9523 1.3355 1.0915 1.0206 1.0073
0.0030 3.0000 2.1198 1.5034 1.1848 1.0592 1.0289
0.0040 3.0000 2.2283 1.6362 1.2808 1.1137 1.0674
0.0050 3.0000 2.3049 1.7426 1.3723 1.1783 1.1201
0.0060 3.0000 2.3630 1.8301 1.4574 1.2484 1.1825
0.0070 3.0000 2.4097 1.9042 1.5363 1.3208 1.2508
0.0080 3.0000 2.4486 1.9686 1.6099 1.3935 1.3219
0.0090 3.0000 2.4818 2.0259 1.6788 1.4653 1.3937
0.0100 3.0000 2.5109 2.0775 1.7435 1.5355 1.4651
0.0110 3.0000 2.5371 2.1250 1.8047 1.6033 1.5348
0.0120 3.0000 2.5613 2.1691 1.8625 1.6685 1.6023
0.0130 3.0000 2.5835 2.2104 1.9173 1.7312 1.6675
0.0140 3.0000 2.6045 2.2492 1.9694 1.7911 1.7299
0.0150 3.0000 2.6240 2.2859 2.0189 1.8483 1.7898
0.0160 3.0000 2.6424 2.3205 2.0659 1.9030 1.8470
The column on th extreme left is independent quantity(say X) and the other columns contain multiple Y values observed over X. I'd like to find the value of X when Y = 1.5.
For instance, in the third column the value 1.5 doesn't occur. In such a case, I would like to interpolate. Any suggestion on how this can be done?

  3 Comments

Deepa Maheshvare
Deepa Maheshvare on 13 Jan 2020
I tried something like,
vq1 = interp1(data(3,:),data(1,:),1.5)
it didn't work though.
ananya gupta
ananya gupta on 13 Jan 2020
EXAMPLE 7: EVALUATING FUNCTIONS AT SPECIFIC VALUES
Evaluate \displaystyle f\left(x\right)={x}^{2}+3x - 4f(x)=x2+3x4 at
  1. \displaystyle 22
  2. \displaystyle aa
  3. \displaystyle a+ha+h
  4. \displaystyle \frac{f\left(a+h\right)-f\left(a\right)}{h}hf(a+h)f(a)
SOLUTION
Replace the \displaystyle xx in the function with each specified value.
  1. Because the input value is a number, 2, we can use algebra to simplify.f(2)=22+3(2)4=4+64=6{f(2)=22+3(2)4=4+64=6
  2. In this case, the input value is a letter so we cannot simplify the answer any further.\displaystyle f\left(a\right)={a}^{2}+3a - 4f(a)=a2+3a4
  3. With an input value of \displaystyle a+ha+h, we must use the distributive property.{f(a+h)=(a+h)2+3(a+h)4=a2+2ah+h2+3a+3h4{f(a+h)=(a+h)2+3(a+h)4=a2+2ah+h2+3a+3h4
  4. In this case, we apply the input values to the function more than once, and then perform algebraic operations on the result. We already found that\displaystyle f\left(a+h\right)={a}^{2}+2ah+{h}^{2}+3a+3h - 4f(a+h)=a2+2ah+h2+3a+3h4and we know that\displaystyle f\left(a\right)={a}^{2}+3a - 4f(a)=a2+3a4Now we combine the results and simplify.
f(a+h)f(a)h=(a2+2ah+h2+3a+3h4)(a2+3a4)h
=2ah+h2+3hh =h(2a+h+3)h{cc{ccFactor out h. =2a+h+3{cc{ccSimplify.
If you are intrested to learn matlab from basic to advance then contact to CETPA INFOTECH.
Walter Roberson
Walter Roberson on 14 Jan 2020
Raj comments to ananya,
irrelevant to question
I agree with Raj, this does appear to be talking about something else entirely.

Sign in to comment.

Accepted Answer

Raj
Raj on 13 Jan 2020
You can use 'interp1' command.
For example, in case of third column you can use:
interp1(A(:,4), A(:,1),1.5)
which gives
ans =
0.002979749851102

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019b

Translated by