Ploting an anonymous function
古いコメントを表示
I an trying to plot this graph :
M_a = mb*g*2 - Cw*rIntegral*y_bar
Cw = 0.5*rho*(v^2)*(1/yr^0.286)*(rb+rt)*(h/2)*0.2 % Wind force constant;
c1 = ((rt-rb)/h)^2;
c2 = ((rt-rb)/h)*rb;
c3 = rb^2;
y = linspace(0,h);
M1 = (y) M_a + 2*Cw((c1/4.286)*(y.^(4.286)) + (2*c2/3.286)*(y.^(3.286)) + (c3/2.286)*(y.^(2.286))) - F_ax*y;
plot(y,M1(y))
and it gives me this error:
M1 = @ (y) + 2*Cw((c1/4.286).*(y.^(4.286)) + (2*c2/3.286).*(y.^(3.286)) + (c3/2.286).*(y.^(2.286))) - F_ax.*y;"
回答 (1 件)
Star Strider
2020 年 10 月 24 日
It appears that ‘Cw’ also needs to be an anonymous funciton, however it is absolutely not obvious what variable it supposed to be a function of.
So:
M_a = mb*g*2 - Cw*rIntegral*y_bar
Cw = @(something) 0.5*rho*(v^2)*(1/yr^0.286)*(rb+rt)*(h/2)*0.2 % Wind force constant;
c1 = ((rt-rb)/h)^2;
c2 = ((rt-rb)/h)*rb;
c3 = rb^2;
y = linspace(0,h);
M1 = (y) M_a + 2*Cw((c1/4.286)*(y.^(4.286)) + (2*c2/3.286)*(y.^(3.286)) + (c3/2.286)*(y.^(2.286))) - F_ax*y;
plot(y,M1(y))
It will aso be necessary to vectorise it, since it and ‘M1’ appear to be a functions of a vector. See Array vs. Matrix Operations for details.
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!