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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!