daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. % zad #2
  2. clear all;
  3. x = -1:0.01:1;
  4. nums = -1:0.01:1;
  5. num = 10000;
  6. saw1 = lab0(0.123, num)*2-1;
  7. saw2 = lab0(0.521, num)*3;
  8. exp1 = log(2*x) .* (x<=0.5) - log(2-2*x) .* (x>0.5);
  9. varx = zeros(1,length(nums));
  10. vary = zeros(1,length(nums));
  11. for i = 1:num
  12.        varx(i) = interp1(nums,exp1,saw1(i))/2.5;
  13.        if varx(i) > 1
  14.            varx(i) = 1;
  15.        elseif varx(i) < -1
  16.            varx(i) = -1;
  17.        end
  18.        vary(i) = interp1(nums,exp1,saw2(i));
  19.        if vary(i) > 3
  20.            vary(i) = 3;
  21.        elseif vary(i) < 0
  22.            vary(i) = 0;
  23.        end
  24. end
  25.  
  26.  
  27.  
  28. figure;
  29. %plot(varx, vary, "r*");
  30. wyk = exp(-x);
  31. hold on;
  32. plot(x,wyk);
  33. [in, on] = inpolygon(varx, vary, x, wyk);
  34. plot(varx(~in), vary(~in), "r*");
  35. plot(varx(in), vary(in), "g*");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top