matlab中符号表达式如果含有字母符号,就不能转化为double类型,所以,可先计算出数值符号值,再转化。可这样改:
clc;clear;
%syms a b m n h x alpha
syms x
a=0.89;b=0.6;alpha=deg2rad(4.1);m=0.4;n=2.05;
h=15;%可改为别值
hmin=double(n*tan(alpha));hmax=double(2*b-m*tan(alpha));
y=h-(x-m)*tan(alpha);
s=(a/b)*(pi*b^2*(1-1/pi*acos((y-b)/b))+(y-b)*(b^2-(y-b)^2)^(1/2));
v=int(s,x,0,m+n);
v=double(v);
plot(v,'*r')