Azzera filtri
Azzera filtri

How do I find the function corresponding to a graph image?

51 visualizzazioni (ultimi 30 giorni)
Dear MATLAB community,
I am trying to find the mathematical function corresponding to the following green curve (although I would be most thankful for suggestions for the blue one also). Unfortunately, I don't have the underlying data with which it was created. Can anyone help?
Thanks a lot in advance!

Risposta accettata

Mehmed Saad
Mehmed Saad il 7 Apr 2020
Extract Data
After that you can find mathematical function
  4 Commenti
Karam Chehade
Karam Chehade il 8 Apr 2020
Thanks a lot! Could you tell me how you converted it, in case I need to repeat the work with another file?
Mehmed Saad
Mehmed Saad il 8 Apr 2020
Modificato: Mehmed Saad il 8 Apr 2020
This is the code, but you have to convert the picture to this format i.e. remove the other parts ( i used microsoft word for that xD)
this is a long method, i copied this code i don't remeber from where
fullFileName ='C:\Users\PROJECT PC\Pictures\data1.png';
rgbImage = imread(fullFileName);
rgbImage = imresize(rgbImage,10);
[rows, columns, numberOfColorBands] = size(rgbImage);
fontSize = 36
subplot(2, 2, 1);
imshow(rgbImage);
axis on;
title('Original Color Image', 'FontSize', fontSize);
set(gcf, 'Units', 'Normalized', 'Outerposition', [0, 0, 1, 1]);
greenChannel = rgbImage(:, :, 2);
binaryImage = greenChannel < 200;
%
subplot(2, 2, 2);
imshow(binaryImage);
axis on;
title('Binary Image', 'FontSize', fontSize);
verticalProfile = sum(binaryImage, 2);
lastLine = find(verticalProfile, 1, 'last')
for col = 1 : columns
yy = lastLine - find(binaryImage(:, col), 1, 'first');
if isempty(yy)
y(col) = 0;
else
y(col) = yy;
end
end
subplot(2, 2, 3);
plot(1 : columns, y, 'b-', 'LineWidth', 3);
grid on;
title('Y vs. X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
xlabel('X', 'FontSize', fontSize);
%%
y2 = y(174:5213);
t = 0:1/length(y2):1-1/length(y2);
y_norm = y2/max(y2);
figure,plot(t(1:100:end),y_norm(1:100:end))

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by