lowpass関数が使えない
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
%Start of script(初期化)
close all; % close all figures
clear; % clear all variables
clc; % clear the command terminal
%変数の型の定義
format long
M1 = readmatrix('Z6mm6mmmin.csv');
t = M1(:,1);
sz1=size(t);
% A相はcos,B相はsin
A = M1(:,2);
B = M1(:,3);
%y = lowpass(x,fpass,fs) x がfs Hz のレート,fpassはHz単位でのフィルターの通過帯域周波数
fs = 1e5;
fpass = 500;
yA = lowpass(A,fpass,fs);
yB = lowpass(B,fpass,fs);
% yAlab = lowpass(Alab,fpass,fs);
% yBlab = lowpass(Blab,fpass,fs);
figure(1);
hold on;
scatter(t,yA,1);
scatter(t,yB,1);
% scatter(t,yAlab,1);
% scatter(t,yBlab,1);
hold off;
figure(2);
hold on;
scatter(t,A,1);
scatter(t,B,1);
hold off;
上記のプログラムを回すと下記の表現が出てきてローパスフィルタをかけることができません.
スクリプト lowpass を関数として実行することはサポートされていません:
C:\Users\master\Documents\MATLAB\lowpass.m
エラー: lowpass_sinwave (行 21)
yAor = lowpass(Aor,fpass,fs);
原因のわかる方お願いいたします.
2 commentaires
Réponse acceptée
Atsushi Ueno
le 23 Jan 2023
>原因のわかる方お願いいたします
⇒ 上記のQ&Aと同じです。ファイル名を lowpass.m から他の名前に変えるのが手っ取り早い方法です。
【詳細】
MATLAB (Signal Processing Toolbox)の組込関数であるlowpass関数とスクリプトファイル名前が同じ事が原因です。試しにカレントフォルダなどパスの効いた場所に lowpass.m を保存・実行してみると質問と同じエラーが出ます。次にlowpassの在り処を調べると、下記の様に重複している様子が判ります。
which -all lowpass
/MATLAB Drive/lowpass.m
/MATLAB/toolbox/signal/signal/lowpass.m % Shadowed
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Bartlett dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!