Plotting a function that performs a sum.
Mostrar comentarios más antiguos
I defined a function that computes a specific sum and now I want to plot it over x where 0<x<1. I am getting an error saying incompatible sizes and am not sure how to fix it.
f = @(x,y,z) sum(sin((3:15).*sqrt(x*y))+z);
x = linspace(0,1,10);
y = 0.5;
z = 0.1;
plot(x,f(x,y,z))

1 comentario
Joe Vinciguerra
el 6 de Sept. de 2022
You have two arrays in the function of different sizes that you are trying to compute together, namely "x" and [3:15]. They need to be the same size for your function to work. How you resolve that depends on your intent.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
