please help me plotting the curve. Its working fine till second last line but not plotting the curve.

1 次查看(过去 30 天)
syms x A
theta=[0:10:360]
n=4.25
val1=3.271 %value of 6nU
val2=12.45481 %value of 12nw J=(0.2728*(x.^3)-0.0592*x)*(10.^(-3))*0.055*(sind(theta)+(sind(2*theta)./(2*((18.0625-((sind(theta)).^2)).^(1/2)))))
G=val1*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-2))
H=val2*J*int(x*((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3)))
K=A*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3))
y=0.055*((1-cosd(theta))+(n-sqrt(square(n)-(sind(theta)).^2)))
P=G+H+K
P=double(subs(P,(x),(y)))
fplot(theta,P)

采纳的回答

Star Strider
Star Strider 2018-6-20
You have not defined ‘A’, so it is not possible to evaluate ‘P’ in order to plot it.
Changing your code slightly:
syms x A
theta=0:10:360;
n=4.25;
val1=3.271; %value of 6nU
val2=12.45481; %value of 12nw
J=(0.2728*(x.^3)-0.0592*x)*(10.^(-3))*0.055*(sind(theta)+(sind(2*theta)./(2*((18.0625-((sind(theta)).^2)).^(1/2)))));
G=val1*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-2));
H=val2*J*int(x*((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3)));
K=A*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3));
y=0.055*((1-cosd(theta))+(n-sqrt(square(n)-(sind(theta)).^2)));
P=G+H+K;
PF= matlabFunction(P)
fplot(PF, [0 360])
produces:
PF =
function_handle with value:
@(A,x)[(x.*6.424017204651876+x.^3.*2.354624018983744)./(x.^2.*(-4.326979472140762)+ ...
The function is too long to display in the Command Window.
Provide a value for ‘A’, and your code could work.
  3 个评论
Shalabh Singhal
Shalabh Singhal 2018-6-21
Undefined function 'sind' for input arguments of type 'sym'.
Error in Untitled (line 7)
J=(0.2728*(x.^3)-0.0592*x)*(10.^(-3))*0.055*(sind(theta)+(sind(2*theta)./(2*((18.0625-((sind(theta)).^2)).^(1/2)))));
>> This is the error being shown by the command window of matlab 2016a
Star Strider
Star Strider 2018-6-21
That is correct. The degree-argument trigonometric functions are not defined in the Symbolic Math Toolbox. I am using R2018a, that did not throw that error.
Replace:
sind(theta)
with:
sin(theta*pi/180)
and the error should not appear.

请先登录,再进行评论。

更多回答(2 个)

Shalabh Singhal
Shalabh Singhal 2018-6-20
sorry but still not working. Take A=1.5

Shalabh Singhal
Shalabh Singhal 2018-6-20
sir, this is my final code.There is till some issue.I forgot to add 'subs' earlier. syms x
theta=0:10:360;
n=4.25;
val1=3.271; %value of 6nU
val2=12.45481; %value of 12nw
J=(0.2728*(x.^3)-0.0592*x)*(10.^(-3))*0.055*(sind(theta)+(sind(2*theta)./(2*((18.0625-((sind(theta)).^2)).^(1/2)))));
G=val1*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-2));
H=val2*J*int(x*((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3)));
K=2*int((0.0682*(x.^4)-0.2951*(x.^2)+1.041).^(-3));
y=0.055*((1-cosd(theta))+(n-sqrt(square(n)-(sind(theta)).^2)));
P=G+H+K;
P=subs(P,(x),(y));
PF= matlabFunction(P)
fplot(PF, [0 360])

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by