• 使用函数 figure、axes、plot 代码 function shili01 h0=figure('toolbar' ,'none','position',[0,0,500,500],'name','实例01'); axes('parent' ,h0,'visible','...title('sin(x)函数曲线'); grid on 图形界面
使用函数
figure、axes、plot

代码
function shili01
h0=figure('toolbar' ,'none','position',[0,0,500,500],'name','实例01');
axes('parent' ,h0,'visible','off');
x=-pi:0.05:pi;
y= sin(x);
plot(x,y);
xlabel('自变量x');
ylabel('函数值y');
title('sin(x)函数曲线');
grid on

图形界面


展开全文
• % 打开窗体钱先执行该函数 function gui_biancheng_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; handles.x=-pi:0.01:pi; %全局变量 guidata(hObject, handle
guide  （代码：1\gui_biancheng.m）

% 打开窗体钱先执行该函数
function gui_biancheng_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;
handles.x=-pi:0.01:pi;  %全局变量
guidata(hObject, handles);
sin按钮function sin_Callback(hObject, eventdata, handles)

x=handles.x;
y=sin(x);
plot(handles.plotaa,x,y);   %在坐标轴(plotaa)中画线
cos按钮

function cos_Callback(hObject, eventdata, handles)

x=handles.x;
y=cos(x);
plot(handles.plotaa,x,y);  %在坐标轴(plotaa)中画线
clear按钮function clear_Callback(hObject, eventdata, handles)

try
delete(allchild(handles.plotaa));  %清空坐标轴，删除坐标轴的所有孩子结点
end


展开全文
• 没有什么太好的办法。【1】解第一个方程，用1-(cos(x...x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')x=[acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^...
没有什么太好的办法。【1】解第一个方程，用1-(cos(x))^2=(sin(x))^2>>x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')x=[acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))][acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))][acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]【2】变换ctan为1/tan>>y='(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+1/tan(x0))'【3】替换y中的x，为x0的变量>>y1=subs(y,'x',x)y1=[((1-(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))^2)^(1/2)-1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-sin(x0)+cos(x0))*(1+1/tan(x0))][((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))][((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]【4】用ezplot分别画图>>ezplot(y1(1))>>ezplot(y1(2))>>ezplot(y1(3))。全部
展开全文
• 没有什么太好的办法.【1】解第一个方程,用1-(cos(x))... x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')x =[ acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x...
没有什么太好的办法.【1】解第一个方程,用1-(cos(x))^2=(sin(x))^2>> x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')x =[ acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))][ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))][ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]【2】变换ctan为1/tan>>y='(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+1/tan(x0))'【3】替换y中的x,为x0的变量>> y1=subs(y,'x',x)y1 =[ ((1-(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))^2)^(1/2)-1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-sin(x0)+cos(x0))*(1+1/tan(x0))][ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))][ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]【4】用ezplot分别画图>> ezplot(y1(1))>> ezplot(y1(2))>> ezplot(y1(3))
展开全文
• 下面我将介绍用matlab画函数图形的方法，以在同一张图上画出y1=sin(x)和y2=sin^2(x)的图形为例。工具/原料matlab1方法/步骤输入自变量：画已知的函数图形，用向量的方式表示自变量比较方便。代码为x=linspace(0,8); ...
• ## matlab画一元函数图

千次阅读 2017-08-05 15:34:37
x=-1:.1:2; % x的取值范围【-1,2】； y=x.sin(x*pi*x)+2; %前面想乘sin时用点乘，否则会出现错误 %定义 pi;  plot(x,y);
• 写在前面： 我的微信公众号： xiaoshi_IC，小石谈IC，近期已完成了PCB系列，后续后续会逐步完成 IC版图，FPGA设计，信号完整性，IC设计，通信原理系列，做开源的微电子，电子公众分享，坚持做有价值的...% sinc Sin...
• <code>x=linspace(0,200); %100个点的x坐标 ...sin(x); plot(x,y); </code></pre> <p><img alt="" height="326" src="https://img-ask.csdnimg.cn/upload/1616210562970.png" width="317" /></p>
• MATLAB的polar函数？极坐标绘制最大半径怎样设置，类似于plot用axis(xmin xmax ymin ymax)一polar函数不能使用axis类似的语句设置轴的范围。你可以用别的办法，原理如下： h = polar([0 2*pi], [0 1]);% 半径范围0到...
• 解 输入命令 MATLAB liti41 ezplot(‘cos(t)^3’,’sin(t)^3’,[0,2*pi]) 例在[-2,0.5],[0,2]上函数 ex sin(xy) 0 的图. 解 输入命令......解 因为这里的函数是隐函数,化成显函数后有两支,必须使用参数方程,旋 ...
• 脚本程序如下： ...%绘制出函数图像 x = 0:pi/1000:2*pi; %%定义x为0到2pi之间的一组向量，且x向量中相邻两个值之间的增量为pi/1000 y = sin(x); %z = cos(x); figure % 打开新的绘画窗口，可省略该...
• 1.把当前窗口分成四个区域，用不同的颜色和线条分别绘制sin(x),cos(x),e^x,log(x)的函数图形，并加入文字标示和网格。 clear clc x=-2*pi:0.01:2*pi; y1=sin(x); y2=cos(x); y3=exp(x); t=0:0.01:20; y4=log(t); ...
• ## Matlab 三角函数(sin)

万次阅读 2017-10-18 10:56:59
a='这是一个三角函数' t=0:0.01:2*pi; %从0到2pi，步长是0.01 y=sin(t); plot(t,y) %坐标
• 1.选择合适的步长绘制下列函数的图形。 (1)ln((1-x)/(1+x)),x∈(-1,1) (2)sqrt(cos(x)),x∈[-π/2,π/2] (3)sin(1/t),t∈(-1,0)∪(0,1) (4)sin(x)/x,x∈(-0.5,0)∪(0,0.5) clear clc x1=-1+eps:0.01:1; y1=log((1-x1...
• **matlab ** 代码是这样的 x=[0:0.01:2, 2+eps:0.01:4,4]; y=exp(x.^2).*(x)+80./(4-sin(16*pi*x)).*(x>2); y(end)=0; x=[eps, x]; y=[0,y]; fill(x,y,'g') ![图片说明]...
• 我们如下函数的导数图 clc; clear all close all syms x eps = 0.1; u = x-x*x+eps*((1.0/(4*pi))*sin(2*pi*x/eps)-(1.0/(2*pi))*x*sin(2*pi*x/eps)-(eps/(4*pi*pi))*cos(2*pi*x/eps)+(eps/(4*pi*pi))); % ...
• 1.选择合适的步长绘制下列函数的图形。(1)ln((1-x)/(1+x)),x∈(-1,1)(2)sqrt(cos(x)),x∈[-π/2,π/2](3)sin(1/t),t∈(-1,0)∪(0,1)(4)sin(x)/x,x∈(-0.5,0)∪(0,0.5)clearclcx1=-1+eps:0.01:1;y1=log((1-x1)/(1+x1)...
• 该楼层疑似违规已被系统折叠隐藏此楼查看此楼for t=1:284x(t)=+445.2746*cos(0*t)--52.362*sin(0*t)+9.134*cos(0.022124*t)-28.0896*sin(0.022124*t)+1.7007*cos(0.044248*t)--0.30452*sin(0.044248*t)+0.57529*cos...
• matlab解二阶微分方程,解出的结果如下,请问怎样出y和时间t的函数图像?y=dsolve('101*D2y+100*Dy+1000*y=102*sin(20*pi*t)','y(0)=0,Dy(0)=0','t')解出的结果是y=exp(-(50*t)/101)*sin((10*985^(1/2)*t)/101)*((51*...
• Matlab plotyy 双纵坐标图实例 x = 0:0.01:20; y1 = 200*exp(-0.05*x*sin(x; y2 = 0.8*exp(-0.5*x*sin(10*x; [AX,H1,H2] = plotyy(x,y1,x,y2'plot; set(AX(1'XColor'k'YColor'b; set(AX(2'XColor'k'YColor'r; HH1=...
• - PAGE PAGE 2 欢迎下载 Matlab plotyy双纵坐标图实例 x = 0:0.01:20; y1 = 200*exp(-0.05*x*sin(x; y2 = 0.8*exp(-0.5*x*sin(10*x; [AX,H1,H2] = plotyy(x,y1,x,y2'plot; set(AX(1'XColor'k'YColor'b; set(AX(2'...
• 1.polar()-极坐标图 ... polar(t,sin(t).*cos(t),'--m') 2.pie()-圆饼图 >> x=rand(1,5) x = 0.7577 0.7431 0.3922 0.6555 0.1712 >> explode=[1 0 1 0 0]; pie(x,explod...
• ## MATLAB 动画仿真

千次阅读 2018-06-19 13:29:32
matlab调用画图plot函数族，返回该函数的句柄，通过句柄可以修改图形的属性。 t = 0:20; plot_handle = plot(t, sin(t)); // 修改图形属性 set(plot_handle, 'YData', cos(t)); plot_handle1 = plot(t...
• 首先，按照需要在一定时间范围内生成一些时间点，然后调用该函数计算这些点的函数值，最后出其波形图即可。其程序如下： A=1;a=-0.4; t=0:0.001:10; ft=A*exp(a*t); plot(t,ft) （2）正弦信号 正弦信号的...
• ## matlab中plot函数用法

万次阅读 多人点赞 2019-03-06 14:41:15
线条、颜色等参数： 1.简单的2维直线图 : plot(x,...y = sin(x); figure; hold on; plot(x,y) 2.plot(X):X是矩阵，表示矩阵的每一行都一条线，将显示n条线。 X=rand(3,3); %随机生成3*3矩阵 figure; hold on; p...
• MATLAB】用surf函数画出来：三维曲面(色)图。clear all[x,y]=meshgrid(linspace(-15,15));%设定xy范围z=sin((x.^2+y.^2).^0.5)./((x.^2+y.^2).^0.5);figure(1)surf(x,y,z)xlabel('X'),ylabel('Y'),zlabel('Z');...
• ## Matlab图形修饰函数

千次阅读 2016-11-07 21:38:04
源代码：  t=[0:pi/20:4*pi];...plot(t,10*sin(t),'r+:') plot(t,5*cos(t),'b*--') xlabel('时间t'); ylabel('幅度X'); title('简单绘图示例'); legend('x1=10sint:点线','x2=5cost:虚线') gte
• 函数里面是包括正弦的，最后出来成了三角线性的，不应该是曲线么 x=0:pi:10*pi; R2=0.2; y=((1-R2).^2)./((1-R2).^2+4*R2.*(sin(x./2).^2)); plot(x,y) </p>
• plot 函数用于画图。 画图格式：1. plot(x,y) ---------------------------------- 单线 >> x=0:0.01:(pi*2); >> y=sin(x); >> plot(x,y) ...

...

matlab 订阅