Im trying to convolute a rect function and a sinc function

1 view (last 30 days)
Levi Stevens
Levi Stevens on 22 Apr 2022
Answered: Paul on 22 Apr 2022
Im currenlty trying to find the tip angle and to do that I have to use a formula that involves the convolution of a sinc and rect function.
close all
B0 = 1.5;
df = 4.258e4;
A = 2;
t = -1:1e-4:1;
N = length(t);
V = 63.87e6;
tp = 2e-3;
zbar = 0;
z = 0.1:1e-3:1;
dz = 3.33333333333333;
Gz = 3;
a = 2* pi* df* tp* A* rectangularPulse(z/dz);
b = sinc(2* pi* df* tp* Gz(z));
conv2(a,b, 'same')
Here is the Error I get
Array indices must be positive integers or logical values.
Error in hrhrhs (line 19)
b = sinc(2* pi* df* tp* Gz(z));

Answers (1)

Paul on 22 Apr 2022
Because Gz is a variable, not a function, Gz(z) is trying to use the vector z as an index into the variable Gz. But z contains elements that are neither positive integers nor logicals, hence the error.
What is Gz(z) intended to be?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!