how to easily change the function paramters in contour plot

1 view (last 30 days)
Hi fellow, I am using contour to plot something as shown below
if true
% plot([0,100],[100,0])
hold on
[x,y] = meshgrid(0:0.1:100);
f = - (1000*exp((9*x)/2000 - (9*y)/5000))/27 - (1000*exp(- (27*x)/5000 - (9*y)/2000))/27 - (1000*exp((27*y)/5000 - (9*x)/10000))/27
contour(x,y,f,50);
end
My question is how can I easy change the parameters in the function f. f is a function defined on another function f1, i.e, pass some parameters to f1, and then get the expression for f. At the moment, I get the expression for f in this way
if true
load DD
p=[1/3,1/3,1/3];
r=0.009;
edw=100;
plot([0,100],[100,0])
hold on
dd=[DD(1,1:3)-1;DD(1,4:6)-1];
syms x y
f= f1( p,r,dd,edw,[x;y])
end
But I want see the how the plot change with different parameters, for example, r. I have to change r and run the above code in a separate script. When I get the expression for f, then copy paste the code in the first part code in another script. This is very inconvenient. Could you suggest some smarter way of doing this?
PS. I tried this way but it I get the error message "Warning: Contour not rendered for constant ZData " which I don't understand.
if true
% plot([0,100],[100,0])
hold on
load DD
p=[1/3,1/3,1/3];
r=0.009;
edw=100;
plot([0,100],[100,0])
hold on
dd=[DD(1,1:3)-1;DD(1,4:6)-1];
f =@(x,y) -eucara( p,r,dd,edw,[x;y])
ezcontour(f,[0,100],50);
end
Cheers, Xueqi

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!