Extraction data from several implicit plots

2 次查看(过去 30 天)
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 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by