please help me plotting the curve. Its working fine till second last line but not plotting the curve.
1 view (last 30 days)
Show older comments
Shalabh Singhal
on 20 Jun 2018
Commented: Star Strider
on 21 Jun 2018
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)
0 Comments
Accepted Answer
Star Strider
on 20 Jun 2018
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 Comments
Star Strider
on 21 Jun 2018
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.
More Answers (2)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!