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