Info

This question is closed. Reopen it to edit or answer.

Need help very new to Matlab

2 views (last 30 days)
Cgpat
Cgpat on 22 May 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello,
Basically I'm creating this program to find the amount of displacement taking place with this object. The data is not the same size and have more (x1,y1) points than (x2,y2). All of the points are already sorted and have some repetitive values in the x's. I basically need y2 to find its matching value below or above .01 in the y1 column. I then need the x-value to come over with it and have (x1-x2). I've work on this for about 2 weeks now and am still a failure at this please help!! Student =(
x1
0.00022000
0.00022000
0.00022000
0.00022000
0.00023000
0.00023000
0.00024000
0.00024000
0.00024000
0.00025000
y1
0.6926
0.69788
0.70216
0.70528
0.70885
0.71412
0.7192
0.72287
0.72588
0.73059
x2
0.00015
0.00015
0.00016
0.00016
0.00016
0.00017
0.00017
0.00018
0.00018
0.00018
y2
3.7302
3.79006
3.85006
3.9087
3.96475
4.01791
4.06763
4.11372
4.15619
4.19552
%%read data file
a = xlsread('book5', 'A:H')
%%create unique points from data set 1
ext1=a(:,2);
load1=a(:,4);
[ext1_u,I_unique1]=unique(ext1);
load1_u = load1(I_unique1);
%%create unique points from data set 2
ext2=a(:,6);
load2=a(:,8);
I=(~isnan(load2));
ext2=ext2(I);
load2=load2(I);
[ext2_u, I_unique2] = unique(ext2);
load2_u = load2(I_unique2);

Answers (1)

Matt Kindig
Matt Kindig on 22 May 2012
What does this part mean "I basically need y2 to find its matching value below or above .01 in the y1 column"? y2 differs from y1 by more than 0.01 for all values of y1. Can you clarify your goal, ideally showing us what your desired output looks like?
  1 Comment
Cgpat
Cgpat on 23 May 2012
What I meant by that is for example "y2= 5.24" it then match up with a value of one above and one below that value so for example it found "y1=5.23 or 5.25". After they were match and sorted, I want the x-values that are associated with the y-values to carry over.
The experiment I'm running is basically two springs in series with a force coming down. My goal is figure out how much the top spring is moving. Basically I need to subtract the movement of the bottom spring to the top spring. However I have to make sure that the forces are lined up in order to subtract. I just notice the data I gave above is wrong and this is a better sample of the data
x1
0.00145000
0.00146000
0.00146000
0.00147000
0.00147000
0.00149000
0.00149000
0.00150000
0.00150000
0.00150000
0.00152000
0.00152000
0.00152000
0.00152000
0.00153000
0.00154000
0.00155000
0.00155000
0.00155000
0.00155000
y1
3.69588
3.70753
3.71856
3.72985
3.74111
3.81516
3.82577
3.83723
3.84859
3.85943
3.91044
3.92157
3.93168
3.94096
3.9494
4.00756
4.01811
4.02947
4.0408
4.05229
x2
0.00015
0.00015
0.00016
0.00016
0.00016
0.00017
0.00017
0.00018
0.00018
0.00018
y2
3.7302
3.79006
3.85006
3.9087
3.96475
4.01791
4.06763
4.11372
4.15619
4.19552

This question is closed.

Community Treasure Hunt

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

Start Hunting!