Comparing curves to an original signal

27 ビュー (過去 30 日間)
Amanda Botelho Amaral
Amanda Botelho Amaral 2021 年 12 月 14 日
コメント済み: Jon 2021 年 12 月 17 日
I'm trying to compare two curves. They represent the same situation. One curve is the original system and a second this system is undergoing some changes. I would like to compare them. What changes made to the second curve affect the first. And knowing these variations, is it possible for me to go back to the original curve? My curves are experimental data.
I thought about choosing an equation or model that best describes my curve and fitting it using curve fitting or optimization. But I still can't think of something to compare them
  5 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 12 月 15 日
sorry for my last sentence it was just making the whole think more confusing - forget it
just now I don't really see what you mean by "I would like to get the curve in yellow, starting from the purple one."
do you mean reduce the initial vertical gap so that both curves are overlaid ?
Amanda Botelho Amaral
Amanda Botelho Amaral 2021 年 12 月 15 日
I think I confused you, sorry!
Something similar.... I would like to know a variable, or some element that I can compare.
For example, I have the equation of a curve (Linear), if I change the angular coefficient of this line, I have a new curve. So if I compare the two, can I know what the angular coefficient of each one is? I thought of something like that....
Sorry for my English, I'm learning!

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

採用された回答

Jon
Jon 2021 年 12 月 15 日
In terms of frequency response of a transfer function it looks like you could make the orange curve move towards the purple curve by adjusting the gain of the transfer function to change the low frequency value. You could provide a pole in the denominator whose value would adjust the high frequency roll off.
  9 件のコメント
Amanda Botelho Amaral
Amanda Botelho Amaral 2021 年 12 月 17 日
Thank you so much for the tip!
helped me a lot
Helped me a lot! I ended up commenting in the comment above about another question. Would you help me?
Jon
Jon 2021 年 12 月 17 日
Hi,
It looks like you were able to solve your second problem.
For the future, it would be good to start a new question if you have an new unrelated, or only distant related issue. That way the answer threads stay clean, and later people can find answers if they have the same question.

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

その他の回答 (1 件)

Mathieu NOE
Mathieu NOE 2021 年 12 月 15 日
hello again
so the yellow curve can be shifted to match the purple one by using a linear equation like
y2_shifted = = y2*a+b;
the code provide some initail values for a and b but this could be refined by optimisation
a = ratio2*0.963
b = 1.4
the values 0.963 and 1.4 are my manual fine tuning , but again we could implement a more elegnat and automatic tuning.
see the results now : the yellow has been shifted as close as possible to the purple curve
I just considered that the last portion of the purple curve where the signal sinks would not be taken into account in this procedure...
code :
% extract_data_from_figures
data = extract_data_from_figures('ATE.fig');
x = data.Y(:,1);
y1 = data.Y(:,2);
y2 = data.Y(:,3);
% save amanda.mat x y1 y2 % save in case
% y ratio between the two curves - measured at first x position
ratio2 = y1(1)./y2(1);
y2_shifted = y2*ratio2*0.963+1.4;
figure(1),semilogx(x,y1,x,y2,x,y2_shifted,'r');
legend('y1','y2','y2*ratio2*0.963+1.4');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data = extract_data_from_figures(filename)
%%
%
% Input : File name <filename.fig>
% with multiple plots in a single file
% Output : struct data
% : data.names contains names of the display object Yvalues
% : data.Y contains the actual plot values withthe first column
% containing the x-values
%
% Written by Chetanya Puri, 2019
% Last Modified: Nov 6, 2019
%
fig = openfig(filename); % Open figure and assign it to fig object
dataObjs = findobj(fig,'-property','YData'); % Find all graphic objects with YData, in our case line values
xval = dataObjs(1).XData; % Find the X-axis value
Ymat = [xval(:)]; % Create a matrix with first column of x values
for i=1:length(dataObjs)
legend_name{i,1} = dataObjs(i).DisplayName;
yval = dataObjs(i).YData;
Ymat = [Ymat yval(:)]; % Keep appending column vectors
end
close(fig); % close the figure
data.names = ['X';legend_name];
data.Y = Ymat;
end
  4 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 12 月 17 日
hello
I simply executed this very slightly changed code and I got no such effect
I plot in log x scale so the signal trend is easier in my opinion
load('freq.mat');
load('Z.mat');
n = length(freq);
d_vec = (1:(n))./0.2;
t_vec = (1./freq).*d_vec;
ytime = ifft(ZZ, [], 2);
semilogx(t_vec,ytime);
Amanda Botelho Amaral
Amanda Botelho Amaral 2021 年 12 月 17 日
I found the problem.
I forgot to put the real part of the curve to apply ifft.

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by