attachment:Functions and Calculus.m of SignalAnalysisMatlabSchedule - Methods
location: attachment:Functions and Calculus.m of SignalAnalysisMatlabSchedule

Attachment 'Functions and Calculus.m'

Download

   1 %%
   2 x = -3:0.1:3; %(define your x steps)
   3 y = x.*x; %(define y)
   4 plot(x,y)
   5 
   6 %%
   7 x1=linspace(-10,10,1001); %(define your x steps)
   8 y1=linspace(-10,10,1001)'; %(define your y steps)
   9 [X,Y]=meshgrid(x1,y1); %(combine both into a matrix)
  10 z = X.^2+Y.^2;
  11 imagesc(x1,y1,z) % (2D plot)
  12 
  13 %%
  14 surf(x1,y1,z); shading interp; colorbar % (3D plot)
  15 
  16 %%
  17 x1=linspace(-10,10,1001); %(define your x steps)
  18 y1=linspace(0,20,1001)'; %(define your y steps)
  19 [X,Y]=meshgrid(x1,y1); %(combine both into a matrix)
  20 
  21 wave1D = cos(x1);
  22 plot(x1,wave1D);
  23 
  24 %%
  25 wave2D1 = cos(X + 2*Y);
  26 wave2D2 = cos(0.1*X.^2 + 0.1*Y.^2);
  27 figure;
  28 imagesc(x1,y1,wave2D1) % (2D plot)
  29 figure;
  30 imagesc(x1,y1,wave2D2) % (2D plot)
  31 
  32 %%
  33 wave1 = cos(0.1*(X-2).^2 + 0.1*Y.^2); 
  34 wave2 = cos(0.1*(X+2).^2 + 0.1*Y.^2);
  35 interference = wave1+wave2;
  36 figure
  37 imagesc(x1,y1, wave1) % (wave 1)
  38 figure
  39 imagesc(x1,y1, wave2) % (wave 2)
  40 figure
  41 imagesc(x1,y1, interference) % (sum of the two)
  42 
  43 %%
  44 t = 0:0.1:6; %(define your time steps)
  45 y1 = exp(-2*t).*cos(5*t); %(?>k)
  46 y2 = exp(-2*t).*cos(0.2*t); %(?<k)
  47 figure; hold on; 
  48 plot(t,y1,'r')
  49 plot(t,y2,'k')
  50 
  51 %%
  52 x = -3:0.1:3; %(define your x steps)
  53 y = x.*x; %(define y)
  54 dy = diff(y)/0.1;
  55 figure; hold on; 
  56 plot(x,y,'k');
  57 plot(x(1:end-1),dy,'r');
  58 
  59 %%
  60 syms x1;
  61 y1 = x1.*x1;
  62 dy1 = diff(y1);
  63 ezplot (dy1, [-3 3]);
  64 
  65 %%
  66 syms x;
  67 fun= exp(-x).*cos(x);
  68 dfun = diff(fun);
  69 Q = int(fun,x);
  70 %Q = int(fun,x,[1 2]);
  71 %double(Q)
  72 
  73 %%
  74 syms n; %(Defines x to be a symbol instead of a variable)
  75 fun= n;
  76 count= 1;
  77 for i=0:0.1:3		
  78     integral(count) = int(fun, n,[0 i]);
  79     count  = count + 1;
  80 end
  81 x = 0:0.1:3;
  82 y = x;
  83 figure; hold on; 
  84 plot(x,y,'k');
  85 plot(x,integral,'r');
  86 
  87 %%
  88 Int_y = 0.5*x.*x;
  89 plot(x,Int_y,'b');
  90 
  91 %%
  92 syms n; %(Defines x to be a symbol instead of a variable)
  93 fun= cos(n);
  94 count= 1;
  95 for i=0:0.1:3		
  96     integral(count) = int(fun, n,[0 i]);
  97     count  = count + 1;
  98 end
  99 x = 0:0.1:3;
 100 y = cos(x);
 101 figure; hold on; 
 102 plot(x,y,'k');
 103 plot(x,integral,'r');
 104 
 105 %%
 106 Int_y = sin(x);
 107 plot(x,Int_y,'b');
 108 %%
 109 syms n; %(Defines x to be a symbol instead of a variable)
 110 fun= exp(-n).*cos(n)-n+0.5*n.*n;
 111 count= 1;
 112 for i=0:0.1:3		
 113     integral(count) = int(fun, n,[0 i]);
 114     count  = count + 1;
 115 end
 116 x = 0:0.1:3;
 117 y = exp(-x).*cos(x)-x+0.5*x.*x ;
 118 figure; hold on; 
 119 plot(x,y,'k');
 120 plot(x,integral,'r');
 121 
 122 %%
 123 syms x;
 124 y= tan(x);
 125 int(y, x, [-pi/2 pi/2])
 126 
 127 %%
 128 x1 = -3.1/2:0.1:3.1/2; %(define x-axis)
 129 y1 = tan(x1); %(define your function)
 130 plot(x1,y1)
 131 
 132 %%
 133 figure
 134 hold on
 135 ezplot(y,[-pi/2 pi/2]);
 136 ezplot(0*x,[-pi/2 pi/2]);
 137 
 138 %%

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2018-11-15 14:50:04, 2556.1 KB) [[attachment:ArcherBoyd+Guerit_vocoder_Nov18.zip]]
  • [get | view] (2019-11-21 17:21:33, 1661.8 KB) [[attachment:CBU_FunctionsVocoder_22Nov19.zip]]
  • [get | view] (2019-11-19 16:53:57, 4.6 KB) [[attachment:Code_Optimisation_20Nov19.zip]]
  • [get | view] (2016-03-09 10:59:16, 259.0 KB) [[attachment:DP_Optimisation_2016.zip]]
  • [get | view] (2015-01-20 17:22:38, 614.9 KB) [[attachment:EMEGdata.mat]]
  • [get | view] (2016-02-03 12:32:14, 26.8 KB) [[attachment:ExampleScripts.zip]]
  • [get | view] (2018-01-12 13:39:53, 3150.4 KB) [[attachment:Filtering&Oscillations_ForUpload_TallieJan18.pdf]]
  • [get | view] (2018-07-19 14:49:35, 2.5 KB) [[attachment:Functions and Calculus.m]]
  • [get | view] (2018-07-19 14:49:30, 433.8 KB) [[attachment:Functions and Calculus.pdf]]
  • [get | view] (2015-02-02 09:27:07, 522.0 KB) [[attachment:GLM1.pdf]]
  • [get | view] (2019-11-19 13:06:58, 790.4 KB) [[attachment:GLM1_19Nov19.pdf]]
  • [get | view] (2019-11-19 13:07:11, 2.5 KB) [[attachment:GLM1_19Nov19.zip]]
  • [get | view] (2018-01-12 13:00:28, 9.0 KB) [[attachment:GLM1_Jan2018.m]]
  • [get | view] (2018-01-12 13:02:14, 354.1 KB) [[attachment:GLM1_Jan2018.pdf]]
  • [get | view] (2018-11-13 11:34:38, 11.5 KB) [[attachment:GLM1_Nov2018.m]]
  • [get | view] (2018-11-13 11:34:31, 1417.1 KB) [[attachment:GLM1_Nov2018.pptx]]
  • [get | view] (2018-11-13 12:07:58, 11.5 KB) [[attachment:GLM1_Nov2018_ES18.m]]
  • [get | view] (2018-11-13 12:07:52, 271.1 KB) [[attachment:GLM1_Nov2018_ES18.pdf]]
  • [get | view] (2015-02-02 09:27:27, 2.1 KB) [[attachment:GLM1_script.m]]
  • [get | view] (2016-02-11 18:26:35, 560.4 KB) [[attachment:GLM_part1.pdf]]
  • [get | view] (2018-01-08 09:49:09, 8.5 KB) [[attachment:GLM_workshop.m]]
  • [get | view] (2015-02-18 12:51:09, 580.2 KB) [[attachment:IntroCalculus 18Feb15.pdf]]
  • [get | view] (2015-03-02 18:21:14, 4.3 KB) [[attachment:IntroFilteringOscillations_25Feb15.zip]]
  • [get | view] (2016-02-18 15:52:26, 237.9 KB) [[attachment:IntroGLM2_17Feb16.pdf]]
  • [get | view] (2015-02-04 11:58:10, 125.6 KB) [[attachment:IntroGLM2_4Feb15.pdf]]
  • [get | view] (2016-02-04 17:19:34, 445.3 KB) [[attachment:IntroMatrixAlgebra.pdf]]
  • [get | view] (2015-03-04 12:00:10, 1.3 KB) [[attachment:IntroOptimisation_4Mar15.zip]]
  • [get | view] (2018-01-09 12:44:37, 19.3 KB) [[attachment:Matlab_Files.zip]]
  • [get | view] (2015-01-20 17:29:01, 6.1 KB) [[attachment:MatrixAlgebra.m]]
  • [get | view] (2018-11-13 12:08:14, 917.4 KB) [[attachment:Matrix_Algebra_AT18.pdf]]
  • [get | view] (2015-03-02 18:19:54, 260.9 KB) [[attachment:Olaf FilteringOscillations 25Feb15.pdf]]
  • [get | view] (2015-02-18 12:51:00, 1.8 KB) [[attachment:Olaf IntroCalculus 18Feb15 Matlab.zip]]
  • [get | view] (2016-02-18 15:52:39, 2.9 KB) [[attachment:Olaf IntroGLM2 17Feb2016.m]]
  • [get | view] (2015-02-04 11:58:19, 2.9 KB) [[attachment:Olaf IntroGLM2 4Feb15.m]]
  • [get | view] (2015-03-04 12:00:04, 113.0 KB) [[attachment:Olaf Optimisation 4Mar15.pdf]]
  • [get | view] (2015-01-16 13:56:32, 3.2 KB) [[attachment:Sampling.m]]
  • [get | view] (2015-01-16 13:56:14, 754.0 KB) [[attachment:Sampling.pdf]]
  • [get | view] (2016-02-04 17:19:23, 1107.2 KB) [[attachment:SignalSamplingNoise.pdf]]
  • [get | view] (2018-11-13 12:08:19, 1479.3 KB) [[attachment:Signal_sampling_noise_AT18.pdf]]
  • [get | view] (2018-01-11 09:31:52, 259.2 KB) [[attachment:optimisation.zip]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.