Trying to plot x,y, but it says error in y = f(x);
    3 次查看(过去 30 天)
  
       显示 更早的评论
    
 function graph
 x = 1:100;
 y = f(x);
 plot(x,y);
 end
 function [y] = f(n)
 y = n * log2(n);
 end
0 个评论
采纳的回答
  Star Strider
      
      
 2016-3-17
        You need to use element-wise operations in this line:
   y = n .* log2(n);
0 个评论
更多回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

