close all;home;clc;clear all;
for k=1:1:10;
x(k,1)=k;
y(k,1)=x(k,1)^2; %function here
m1(k,1)=y(k,1);
m1(k,2)=x(k,1);
end
figure (1)
plot(x,y,'linewidth',2)
xlabel('x')
ylabel('y')
figure (2)
plot(m1(:,1),m1(:,2),'square','linewidth',2)
hold on
yMax=max(y);
for k=1:1:yMax;
ty(k,1)=k;
tx(k,1)=interp1(y,x,k);
m2(k,1)=ty(k,1);
m2(k,2)=tx(k,1);
end
plot(m2(:,1),m2(:,2),'linewidth',2)
xlabel('y')
ylabel('x')
hold off
Comments