mbrennwa / mataa Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
To test if you consider it worthwhile.
A simplified model of impedance magnitude and a function to fit the model parameters to measured data.
The fit seems to be not excellent but good enough to get usable Thiele-Small parameters.
function [mag] = impedance_speaker_model (f,params)
Rdc=params(1);
f0=params(2);
Qe=params(3);
Qm=params(4);
Le=params(5);
w0 = 2pif0;
w = 2pif;
% low-frequency impedance (resonance peak, LCR part):
Res = Rdc*Qm/Qe;
Ces = Qe/w0/Rdc;
Les = 1/w0^2/Ces;
ZCes = 1./(iwCes);
ZLes = iwLes;
Zlow = 1 ./ ( 1/Res + 1./ZCes + 1./ZLes );
% total impedance:
Z = Rdc + w * Le + Zlow;
mag = abs (Z);
endfunction
function [Rdc,f0,Qe,Qm,Le] = impedance_fit_speaker (f,mag)
% guess starting value for Rdc:
Rdc = min (mag);
% guess starting values for f0:
u = diff (mag);
F = ( f(1:end-1) + f(2:end))/2;
[u1,k1] = max (u); [u2,k2] = min (u);
if ~exist ('f0','var')
f0 = (F(k1)+F(k2))/2;
endif
clear F
% estimate impedance at f0:
[u,k] = min(abs(f-f0));
Rmax = mag(k);
clear u
clear k
% estimate f1 and f2:
k = find(f<f0);
[u,k] = min(abs(mag(k)-sqrt(Rmax*Rdc)));
f1 = f(k);
clear u
clear k
f2 = f0^2/f1;
% guess starting values for Qe and Qm:
Qm = f0/(f2-f1)*sqrt(Rmax/Rdc);
Qe = Qm / (Rmax/Rdc-1);
% starting value for Le
Le = 0;
clear f1
clear f2
inputparams = [Rdc,f0,Qe,Qm,Le];
[f,p,cvg,iter,corp,covp]=leasqr(f,mag,inputparams,"impedance_speaker_model");
Rdc=p(1);
f0=p(2);
Qe=p(3);
Qm=p(4);
Le=p(5);
endfunction
Just starting with the example RC high-pass filter...
w = mataa_signal_generator('white',96000,0.3);
h = mataa_measure_IR(w,96000);
Creating / resetting to MATAA default settings (command: save -mat ..mataa_settings.mat mataa_settings ; )...
scalar structure containing the fields:
plotColor = b
plotWindow_IR = 1
plotWindow_SR = 2
plotWindow_FR = 3
plotWindow_CSD = 4
plotWindow_ETC = 5
plotWindow_HD = 6
plotWindow_impedance = 7
plotWindow_TBES = 8
openPlotAfterSafe = 1
channel_DUT = 1
channel_REF = 2
interchannel_delay = 0
...done.
error: 'latency' undefined near line 73 column 67
error: evaluating argument list element number 3
error: called from:
error: C:/Users/findelic/Desktop/mataa-User/mataa_tools\mataa_measure_IR.m at line 73, column 18
When compiling TestTonePA19.c as per the instructions in the README, I get warnings on lines:
279, 286, 373, and 383 saying tht format %d expects an int but gets an long unsigned int.
The format for all four should be changed to %lu
Compiling TestDevicesPA19.c I get warnings on lines 140 and 175, too many arguments for format
both printf statements need to be fixed.
Error: File: mataa_measure_signal_response.m
Line: 355 Column: 50
Incorrect use of '=' operator.
To assign a value to a variable, use '='.
To compare values for equality, use '=='.
solved by changing to:
dut_in_unit{k} = '???';
dut_out_unit{k} = '???';
Hello Mathias,
I would follow the standard procedure of forking, modifying and making a pull request, but I believe all is needed is simply to change line 138 in mataa_impedance_fit_speaker.m, writing mataa_impedance_speaker_model_LR2 instead of mataa_impedance_speaker_model.
Best regards,
Esteban
This error occurs when compiling TestTonePA19.c and TestDevicePA19.c per the instructions in the README
gcc -lrt -lasound -lpthread -o TestTonePA19 TestTonePA19.c libportaudio.a
...
/usr/bin/ld: cannot find -lasound
collect2: error: ld returned 1 exit status
Are there other files I need to copy from elsewhere, or paths I need to define?
Note this is regardless of the printf format warnings mentioned in my other issue.
I am using Ubuntu 18.10 in a VM on Windows 10.
and using freshly downloaded MATAA and portaudio files.
I am following the README as written (i.e. with no assumptions made by me.)
Hello Matt. Regarding your MATAA software I have a couple of questions:
to say 1Vpp..?
Thanks!
I really hope this software how help me with the analisys of my tube amp!
Btw, what external sound card would you recommend? I only have the integrated one of my laptop. And that seems to only support 44100 sample rate..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.