I am fitting these curves in my MATLAB but the y-axis of every curve is not matching with that of the textbook figure. Can someone help in this. I am in real worry.

3 次查看(过去 30 天)
This is the graph I want to plot-----
And the parameters are------
But I am getting this graph----
I am also attaching the code which I used-------------------------------------------------------------------------
% implement YanoandKoga1 Model as a Matlab anonymous function
YanoandKoga1 = @(S) 0.51*S./(1.413+S+(S.^2/1250)+(S.^3/4.561));
% calculate mu
mu = YanoandKoga1(S);
hold on
% plot result
plot(S,mu,'k --'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement YanoandKoga2 Model as a Matlab anonymous function
YanoandKoga2= @(S) 0.41*S./(5.23+S+(S.^3/2.64));
% calculate mu
mu = YanoandKoga2(S);
hold on
% plot result
plot(S,mu,'k-'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement AlagappanandCowan Model as a Matlab anonymous function
AlagappanandCowan= @(S)(0.82*S./(4.366+S+(S.^2/2.246)))-(0.004379*(S+2.985));
% calculate mu
mu = AlagappanandCowan(S);
hold on
% plot result
plot(S,mu,'k-o'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement WaymanandTseng Model as a Matlab anonymous function
WaymanandTseng= @(S)(0.3164*S./(0.7346+S))-((0.01618)*(S+0.2886));
% calculate mu
mu = WaymanandTseng(S);
hold on
% plot result
plot(S,mu,'k -.'), xlabel('S (g/l)'), ylabel('\mu (1/h)'), legend('YanoandKoga1','YanoandKoga2', 'AlagappanandCowan','WaymanandTseng');
axis([0 20 0 0.3])
set(gca,'YTick',[0 0.05 .1 0.15 0.2 0.25 0.3 ])
set(gca,'YTickLabel',[0 0.05 .1 0.15 0.2 0.25 0.3 ])
set(gca,'XTick',[0 2 4 6 8 10 12 14 16 18 20 ])
set(gca, 'XTicklabel', [0 2 4 6 8 10 12 14 16 18 20 ])
title('\mu vs S')
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Can anyone tell where I am lacking?
Thanks in advance.
  4 个评论
VBBV
VBBV 2021-1-26
编辑:VBBV 2021-1-26
I mean the desired coefficients for desired amplitudes you want may not be same. The amplitudes you shown in reference figure may require or is using different coefficients than the ones shown.

请先登录,再进行评论。

回答(1 个)

Shubham Khatri
Shubham Khatri 2021-2-3
编辑:Shubham Khatri 2021-2-3
Hello,
You need to define a symbolic variable. You can define it by using syms. For more information on syms please refer to this documentation link. After defining the variable you need to define a range of values for which you need to find the value of the function. I have specified a range from 0 to 20 with an intervel of 0.01 in variable S. Also, I found some typos in the code which I have corrected. Please find the below code.
clc
clear all
syms S
% implement YanoandKoga1 Model as a Matlab anonymous function
YanoandKoga1 = @(S) 0.51*(S./(1.413+S+((S.^2)./1250)+((S.^3)./4.561)));
% calculate mu
S=0:0.01:20;
mu =YanoandKoga1(S);
hold on
% plot result
plot(S,mu,'k --'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement YanoandKoga2 Model as a Matlab anonymous function
YanoandKoga2= @(S) 0.41.*(S./((5.23+S+((S.^3)./2.64))));
% calculate mu
mu = YanoandKoga2(S);
hold on
% plot result
plot(S,mu,'k-'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement AlagappanandCowan Model as a Matlab anonymous function
AlagappanandCowan= @(S)0.82.*(S./(4.366+S+((S.^2)./2.246)))-(0.004379.*(S+2.985)); % NOTICE THE CHANGE IN SIGN
% calculate mu
mu = AlagappanandCowan(S);
hold on
% plot result
plot(S,mu,'k-o'), xlabel('S (g/l)'), ylabel('\mu (1/h)');
% implement WaymanandTseng Model as a Matlab anonymous function
WaymanandTseng= @(S)(0.3164*(S./(0.7346+S)))-((0.01618)*(S+0.2886)); % NOTICE CHANGE IN THE SIGN
% calculate mu
mu = WaymanandTseng(S);
hold on
% plot result
plot(S,mu,'k -.'), xlabel('S (g/l)'), ylabel('\mu (1/h)'), legend('YanoandKoga1','YanoandKoga2', 'AlagappanandCowan','WaymanandTseng');
axis([0 20 0 0.3])
set(gca,'YTick',[0 0.05 .1 0.15 0.2 0.25 0.3 ])
set(gca,'YTickLabel',[0 0.05 .1 0.15 0.2 0.25 0.3 ])
set(gca,'XTick',[0 2 4 6 8 10 12 14 16 18 20 ])
set(gca, 'XTicklabel', [0 2 4 6 8 10 12 14 16 18 20 ])
title('\mu vs S')
Hope it helps

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by