⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clplot2.m

📁 Programs for the book Advanced Engineering Mathematics using MATLAB, 2ndEd.
💻 M
字号:
% CLPLOT2.M Plot an input as 'fn(x.,y.)'. Function must be input as 
%  a string with matrix variables. Input plot limits in x and y.
%  Example:  'x.^2+y.^2+x.*y+2*x+1'
clear                  % Clear variables and
clf                    %  figures 
fn=input('Function to minimize -a string using matrices f(x.,y.)=')
% Plot the function using the limits input
x0=input('Input the plot limits [xmim xmax ymim ymax]= ')
x=[x0(1):.1:x0(2)];    % Create x and y points
y=[x0(3):.1:x0(4)];
%
% Use a mesh
X=x0(1):1:x0(2);
Y=x0(3):1:x0(4);
[x,y]=meshgrid(X,Y);    % Form matrices for x and y
fgrid=eval(fn);         % Form a grid of function values	
surfc(x,y,fgrid)        % Plot surface 	
xlabel('x')
ylabel('y')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -