![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/425288/image.png)
Graphing a messy 5th degree polynomial function
1 次查看(过去 30 天)
显示 更早的评论
I am trying to graph the function 'm' as a function of 'r'. I continuously am getting an error message in the function line. Could some body please help me succesfully graph this? I would like the domain to be 5.75*10^-8 to 2*10-6
This is my script so far:
DabF = 5.662*10^-6; % cm^2/s
Cao = .08; % g/cm^3
L = 250*10^-4; % cm
S = 42; % cm^2
Tao = 1; % unitless
Eps = .4; % unitless
a = 5.75*10^-6; % cm
r = linspace(0,1,10*10^-5);
m = (DabF/L)*Eps*S*((1-(a/r))^2)*(1-2.1*(a/r)+2.09*(a/r)^(3)-.95*(a/r)^(5))*(Cao/Tao);
plot(m,r)
0 个评论
回答(1 个)
Image Analyst
2020-11-23
You can't have 10^(-4) elements in your array. You need at least 1.
r = linspace(0,1,10*10^-5);
How many do you want? Say, 1000? Try it this way, using dot operators to do element by element operations on vectors:
DabF = 5.662*10^-6; % cm^2/s
Cao = .08; % g/cm^3
L = 250*10^-4; % cm
S = 42; % cm^2
Tao = 1; % unitless
Eps = .4; % unitless
a = 5.75*10^-6; % cm
numPoints = 1000;
r = linspace(0, 1, numPoints);
term1 = (DabF/L)*Eps*S*((1-(a./r)).^2);
term2 = (1-2.1*(a./r) + 2.09*(a./r).^(3) - .95*(a./r).^(5));
% m = (DabF/L)*Eps*S*((1-(a./r)).^2)*(1-2.1*(a./r)+2.09*(a./r).^(3)-.95*(a./r).^(5))*(Cao/Tao);
m = term1 .* term2 *(Cao/Tao);
plot(r, m)
grid on;
xlabel('r', 'FontSize', 15);
ylabel('m', 'FontSize', 15);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/425288/image.png)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!