Please help me to check my code

1 visualización (últimos 30 días)
Nicia Nanami
Nicia Nanami el 28 de Ag. de 2017
Comentada: Star Strider el 28 de Ag. de 2017
I have a problem when running my code. For some reason , my plotting doesn't work, thus my graph is complete blank when I run the code. Please kindly help me to check it. This is script using loop with quad
My function:
function [ g ] = myfun( w,u )
g=1./(9.*(w.^n)-8.*w);
end
My script:
u=[4:1:10];
for iu=1:length(u)
h=quad(@(w)myfunc(w,n(iu)),6,10);
v=h(:,1)
plot(u,v)
end
Thank in advance

Respuestas (1)

Star Strider
Star Strider el 28 de Ag. de 2017
Try this:
myfunc = @(w,n) 1./(9.*(w.^n)-8.*w);
u=[4:1:10];
n = some vector;
for iu=1:length(u)
v(iu) = quad(@(w)myfunc(w,n(iu)),6,10);
end
figure(1)
plot(u, v)
  4 comentarios
Nicia Nanami
Nicia Nanami el 28 de Ag. de 2017
Thank you so much. I greatly appreciate your help.
Star Strider
Star Strider el 28 de Ag. de 2017
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by