help for frequency response based system identification #151
Astik-2002
started this conversation in
General
Replies: 1 comment 4 replies
-
The problem is likely that you have written frd_data = FRD(response, freq) but the arguments should be reversed frd_data = FRD(freq, response) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use this code to estimate a parametric transfer function from frequency response data `using ControlSystemIdentification
using ControlSystemsBase
using Plots
using LinearAlgebra
using CSV
using DataFrames
Sample time
t = 0.01
Read data from CSV file
data = CSV.read("/home/astik/Downloads/frequency_response_p.csv", DataFrame)
freq = data.Frequency
mag = data.Magnitude
phase = data.Phase
phase_radians = deg2rad.(phase)
Convert magnitude and phase to complex form
response = mag .* exp.(1im .* phase_radians)
Create FRD object
frd_data = FRD(response, freq)
G0 = tf(1.0, [1,1,1]) # Initial guess
G = tfest(frd_data, G0)
And I'm getting this error
MethodError: no method matching isless(::Int64, ::ComplexF64)Closest candidates are:
isless(::Missing, ::Any)
@ Base missing.jl:87
isless(::Any, ::Missing)
@ Base missing.jl:88
isless(::Integer, ::ForwardDiff.Dual{Ty}) where Ty
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
...
Stacktrace:
[1] <(x::Int64, y::ComplexF64)
@ Base ./operators.jl:352
[2] >(x::ComplexF64, y::Int64)
@ Base ./operators.jl:378
[3] tfest(data::FRD{…}, p0::@NamedTuple{…}, link::Function; freq_weight::ComplexF64, refine::Bool, opt::Optim.BFGS{…}, opts::Optim.Options{…})
@ ControlSystemIdentification ~/ControlSystemIdentification.jl/src/arx.jl:708
[4] tfest(data::FRD{Vector{…}, Vector{…}}, p0::@NamedTuple{b::Vector{…}, a::Vector{…}}, link::Function)
@ ControlSystemIdentification ~/ControlSystemIdentification.jl/src/arx.jl:683
[5] tfest(::FRD{…}, ::TransferFunction{…}; kwargs::@kwargs{})
@ ControlSystemIdentification ~/ControlSystemIdentification.jl/src/arx.jl:748
[6] tfest(::FRD{Vector{…}, Vector{…}}, ::TransferFunction{Continuous, ControlSystemsBase.SisoRational{…}})
@ ControlSystemIdentification ~/ControlSystemIdentification.jl/src/arx.jl:744
[7] top-level scope
@ ~/ControlSystemIdentification.jl/examples/mat_to_frd.jl:26
Some type information was truncated. Use
show(err)
to see complete types.`how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions