Advertisement
BORUTO-121

eval_function(21)

Mar 6th, 2022
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [x,y]=zad("x",[-10 10],100);
  2. function [x,y]=zad(funkcija,interval,N)
  3.     if(nargin==1)
  4.         interval=[0 10];
  5.         N=100;
  6.     elseif(nargin==2)
  7.         N=100;
  8.     elseif(nargin==0)
  9.         eror=MException('MATLAB:Test','Nedovoljno argumenata');
  10.         throw(eror);
  11.     end
  12.     x=linspace(interval(1),interval(2),N);
  13.     y=eval(funkcija);
  14.     plot(x,y);
  15.     xlabel("x");
  16.     ylabel("y");
  17.     title("y(x)");
  18. end
  19.  
Advertisement
RAW Paste Data Copied
Advertisement