Extraction data from several implicit plots

조회 수: 3 (최근 30일)
Yuriy Yerin
Yuriy Yerin 2022년 3월 2일
편집: Yuriy Yerin 2022년 3월 2일
Hello everybody.
I'd like to extract data from the figure of two plots of implicit functions in the form of txt file according to the code below
function z=data_test
f1=@(x,y) 4*x.^3+10*y.^2-x-3;
f2=@(x,y) x.^2-y.^2-1;
fimplicit(f1,[-4 4 -3 3],'MeshDensity',100)
hold on
fimplicit(f2,[-4 4 -3 3],'MeshDensity',100)
fig=gcf;
data_x=findobj(fig,'-property','XData');
x1=data_x(1).XData;
data_y=findobj(fig,'-property','YData');
y1=data_y(1).YData;
A = [x1; y1];
fileID = fopen('data_test1.txt','w');
fprintf(fileID,'%10.8f %15.17f\n',A);
fclose(fileID);
end
However, the goal is to produce a file with three columns, where the first column corresponds to x, while two others are for values of y for functions f1 and f2. Is it possible to create a file with such a structure?
I appreciate for any help and suggestions.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by