code no longer working

4 Ansichten (letzte 30 Tage)
James Webber
James Webber am 28 Feb. 2024
Kommentiert: Image Analyst am 28 Feb. 2024
hi all my code was working last night fully but no longer working when trying to get it to run today i ahve changed nothing today and the error is due to the filtfilt function.
i have checked multiple times but it is not working
any ideas
below is the bit of code casuing the issue and the error
Error in group_04 (line 197)
Sjforce_filtered=filtfilt(b,a,SjForce);
%usign butterworth to filta the data
%selecting the cut of frequency
%cut of frequency will be the smame for both
Force_cutfreq=7;
%setting the code for both standard and squat jump
[b,a]=butter(2,Force_cutfreq/(Freq1/2),'low');
%for the standard jump jump
Sjforce_filtered=filtfilt(b,a,SjForce);
%for the squat jump
Sqforce_filtered=filtfilt(b,a,SqForce);
  4 Kommentare
Torsten
Torsten am 28 Feb. 2024
Bearbeitet: Torsten am 28 Feb. 2024
If you can use "filtfilt" in the other code, it can't be a licence problem.
Then check your inputs b, a and SjForce if they fulfill the documented requirements:
b, aTransfer function coefficients
vectors
Transfer function coefficients, specified as vectors. If you use an all-pole filter, enter 1 for b. If you use an all-zero (FIR) filter, enter 1 for a.
Example: b = [1 3 3 1]/6 and a = [3 0 1 0]/3 specify a third-order Butterworth filter with a normalized 3-dB frequency of 0.5π rad/sample.
Data Types: single | double
xInput signal
vector | matrix | N-D array
Input signal, specified as a real-valued or complex-valued vector, matrix, or N-D array. x must be finite-valued. The length of x must be greater than three times the filter order, defined as max(length(B)-1, length(A)-1). The function operates along the first array dimension of x unless x is a row vector. If x is a row vector, then the function operates along the second dimension.
Example: cos(pi/4*(0:159))+randn(1,160) is a single-channel row-vector signal.
Example: cos(pi./[4;2]*(0:159))'+randn(160,2) is a two-channel signal.
Data Types: single | double
Complex Number Support: Yes
Image Analyst
Image Analyst am 28 Feb. 2024
% Check that user has the specified Toolbox installed and licensed.
%hasLicenseForToolbox = license('test', 'image_toolbox'); % Check for Image Processing Toolbox.
% hasLicenseForToolbox = license('test', 'Image_Acquisition_Toolbox'); % Check for Image Acquisition Toolbox.
% hasLicenseForToolbox = license('test', 'Statistics_Toolbox'); % Check for Statistics and Machine Learning Toolbox.
hasLicenseForToolbox = license('test', 'Signal_Toolbox'); % Check for Signal Processing Toolbox.
% hasLicenseForToolbox = license('test', 'Video_and_Image_Blockset'); % Check for Computer Vision System Toolbox.
% hasLicenseForToolbox = license('test', 'Neural_Network_Toolbox'); % Check for Deep Learning Toolbox.
if ~hasLicenseForToolbox
% User does not have the toolbox installed, or if it is, there is no available license for it.
% For example, there is a pool of 10 licenses and all 10 have been checked out by other people already.
ver % List what toolboxes the user has licenses available for.
message = sprintf('Sorry, but you do not seem to have the Signal Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
else
fprintf('You do have a license for that toolbox, even though it may be installed.\n')
end

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by