Importing Voltage Data to AC Voltage Source in Simulink
Mostra commenti meno recenti
I would like to import voltage data from text in matlab and then I would like to use this data in simulink AC voltage source .I have written one code but not sure is it okay or not as it is not
% Import voltage data from text file
data = importdata('voltage_data.txt');
time = data.data(:, 1); % time data in seconds
voltage = data.data(:, 2); % voltage data in volts
mdl = 'ac_source_model';
open_system(mdl);
set_param(mdl, 'Solver', 'ode23');
% Add AC voltage source to model
add_block('Simscape / Electrical / Specialized Power Systems / Sources/AC Voltage Source', [mdl '/Voltage Source']);
set_param([mdl '/Voltage Source'], 'Amplitude', 'voltage');
set_param([mdl '/Voltage Source'], 'Frequency', '50');
set_param([mdl '/Voltage Source'], 'Phase', '0');
% Run simulation
sim(mdl);
It can't find the block from simulink using this code.Is this way is okay or is there any other way I can use variable text data in simulink(As Voltage Source). N:B:I have read that there is a block called From Workspace which can also be used for this purpose
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Simulink in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
