フィルターのクリア

Determine point intersection of 2 vectors with different values.

4 ビュー (過去 30 日間)
Emilian
Emilian 2014 年 4 月 15 日
回答済み: Star Strider 2014 年 4 月 16 日
Hi,
I want to find the intersection point of 2 number series a=[0.1 0.3 0.5 0.7 0.9] b=[-0.0687 -0.0761 -0.0624 -0.0325 -0.0048] I would like to find the values of b for a at having a single step instead of a double one so a would look like:
a=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]
I am able to plot the curve using the standard plot function and see where approximately the lines intersect but I'd be nice to have the exact value instead of an approximation.
Does anyone have a solution
  2 件のコメント
David Sanchez
David Sanchez 2014 年 4 月 15 日
What do yo mean by " the intersection point of 2 number series " ??
I have read your question several times and can not figure out what exactly you want to achieve. Could you give a more cleat example of your goal from your input?
Emilian
Emilian 2014 年 4 月 16 日
Well I have a tale of values with first row 0.1 0.3 0.5 0.7 0.9 and second row -0.0687 -0.0761 -0.0624 -0.0325 -0.0048. When I plot them I can see a graph with intersection point at the coordinates because I represent them as vectors.
The code I am using is really simple I just don't remember the function I have to use because it has been a while since I last worked with Matlab
if true
% code
clc; clear all; close all
% graph plot of table 11.2 Roarks stress and strain formulas
%change a from a=[0.1 0.3 0.5 0.7 0.9] to:
a=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]; %increment of 0.1
%change increment of a to 0.2 so I can determine value of b with more precision
b=[-0.0687 -0.0761 -0.0624 -0.0325 -0.0048];
figure
plot(a,b)
grid on
grid minor
end
Since I change the vector length of a I am unable to plot the values.
I hope this is a better explanation :)

サインインしてコメントする。

回答 (3 件)

ragesh r menon
ragesh r menon 2014 年 4 月 15 日
If you need analytical solution, then you should first have analytical expressions like polynomial expressions etc. . So use "cftool" to fit polynomial with your current data.(I use the word polynomial since "b" seems to be nonlinear function). Once you get the required polynomials you can solve using "solve" in matlab
  1 件のコメント
Emilian
Emilian 2014 年 4 月 16 日
The value of "b" is a polynomial, that is true. This helps, thanks! But I am would like to display all the values in between instead of manually putting them in in the cftool window.

サインインしてコメントする。


ragesh r menon
ragesh r menon 2014 年 4 月 16 日
Could you explain ? I didn't follow it precisely

Star Strider
Star Strider 2014 年 4 月 16 日
By ‘intersect’ do you mean ‘interpolate’?
If so, this works:
a=[0.1 0.3 0.5 0.7 0.9];
b=[-0.0687 -0.0761 -0.0624 -0.0325 -0.0048];
a2=[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9];
b2 = interp1(a,b,a2);
The plots of plot(a,b) and plot(a2,b2) will look the same, because interp1 does a linear interpolation by default. (See the documentation for interp1 for other options.)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by