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

1 visualización (últimos 30 días)
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)

Respuesta aceptada

Star Strider
Star Strider el 20 de Jun. de 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 comentarios
Shalabh Singhal
Shalabh Singhal el 21 de Jun. de 2018
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 el 21 de Jun. de 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.

Iniciar sesión para comentar.

Más respuestas (2)

Shalabh Singhal
Shalabh Singhal el 20 de Jun. de 2018
sorry but still not working. Take A=1.5

Shalabh Singhal
Shalabh Singhal el 20 de Jun. de 2018
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])

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by