why can't i map this function?

r=1:0.5:9;
i=0.5:0.5:4.5; n=12;
p=1./(n*log(1+0.01.*i));
t=log(r).*p;
figure; plot(r,t); xlabel('r');ylabel('t');

 Respuesta aceptada

Star Strider
Star Strider el 17 de Abr. de 2017

0 votos

You can’t plot it because ‘r’ is (1x17) and ‘p’ is (1x9). You cannot multiply vectors whose lengths are not the same, at least the way you have written your code.

2 comentarios

Catherine Ma
Catherine Ma el 17 de Abr. de 2017
thank you so much!
Star Strider
Star Strider el 17 de Abr. de 2017
As always, my pleasure!
If you want to create them both to be the same lengths, with different increments (or ‘step length’), you can use the linspace function.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Abr. de 2017

Comentada:

el 17 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!