I\'m asking about an error I\'m getting in my matlab assignment. Here\'s my code
ID: 3553817 • Letter: I
Question
I'm asking about an error I'm getting in my matlab assignment.
Here's my code:
function ph = magdb(h)
% MAGDB Display magnitude of Fourier transform of h[n] on a dB scale.
% ph = magdb(h)
theSpace = linspace(0, pi, 512);
fastFour = fft(h, 1024);
magnitude = sqrt((real(fastFour).^2) + (imag(fastFour).^2));
bigMag = 20*log10(magnitude(1:512));
%actually plot it
thePlot = plot(theSpace/pi, bigMag, 'LineWidth', 2);
grid on;
ylabel('|H(omega)|');
xlabel('omega(rad/pi)');
axis ([0 1 -60 5]);
ph = {thePlot};
return
When I test it with my teacher's p file(a protected file) I get this error
Error using set
Conversion to double from cell is not possible.
I've checked into the error abit and some people suggested using cell2mat, mat2str, or str2num but I'm still abit lost. Please help....
Explanation / Answer
You can use "abs(fastFour)" to get the magnitude of the fft signal
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.