MATLAB: Please help me plotting the curve. Its working fine till second last line but not plotting the curve.

doubleMATLABplotsymbolic

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)

Best Answer

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.