matlab - plot from data not a function -
if plot
sin(x*y) you see lines.
if u have coordinates of points of these lines , want plot theme
(connecting dots without using sin(x*y) function), how possible?
codes, try obtain coordinates of each 'x'(beta-bar) each 'lam' and
save roots in matrix.
clc; clear; lmin=0.8; lmax=2.5; bmin=1; bmax=1.5; lam=linspace(lmin,lmax,100); n=length(lam):-1:1 increment=0.001; tolerence=1e-14; xstart=bmax-increment; x=xstart; dx=increment; m=0; while x > bmin while dx/x >= tolerence if sign(f(lam(n),x))*sign(f(lam(n),x-dx))<0 dx=dx/2; else x=x-dx; end end m=m+1; r(m,n)=x; dx=increment; x=0.999*x; end end figure hold on,plot(lam,r(1,:),'b') plot(lam,r(2,:),'c') plot(lam,r(3,:),'r') xlim([lmin,lmax]);ylim([bmin,bmax]), xlabel('\lambda(\mum)'),ylabel('\beta-bar') and
function y=f(x,y)
y=sin(4*x*y);
end
what wrong it?
how separately plot each line?
use plot(x1,y1,...,xn,yn) see link more details http://www.mathworks.com/help/techdoc/ref/plot.html
Comments
Post a Comment