Im trying to convolute a rect function and a sinc function
8 次查看(过去 30 天)
显示 更早的评论
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.
clear
clc
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));
0 个评论
回答(1 个)
Paul
2022-4-22
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?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!