How do I find the function corresponding to a graph image?
51 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Karam Chehade
le 7 Avr 2020
Modifié(e) : Mehmed Saad
le 8 Avr 2020
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/282480/image.png)
Réponse acceptée
Mehmed Saad
le 7 Avr 2020
Extract Data
After that you can find mathematical function
4 commentaires
Mehmed Saad
le 8 Avr 2020
Modifié(e) : Mehmed Saad
le 8 Avr 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/282774/image.png)
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))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Colormaps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!