一些基本操作
- %用散点画平滑曲线
a=[ ];
b=[ ];
plot(a,b);
%画出表达式图像
x=linspace(0,100)
y=10*x+20
plot(x,y)%对于坐标轴的操作
xlabel('blabla')
title('blabla')
set(gca, 'XLim', [0,30]) %设置坐标轴范围
拟合操作
%拟合直线
p=polyfit(a,b,1)%根据拟合出的曲线得到表达式
首先确定你把拟合曲线图画出来了,然后在figure1上边的选项中按Tools----BasicFitting-----cubic----Showequations----plotresiduals-----"然后点向右的箭头"-----”再从右边选项框里选Savetoworkspace“
方程操作
- %求两直线交点
S = solve('y=3.01x-5','y=(-5x)+20.003','x','y');
S.x
S.y
figure; plot(a,b); hold on
y=0.8674*x-44.1388
plot(x,y,'r')
set(gca,'YLim',[0,30])
xlabel('I/mA')
ylabel('P/mW')