getting wrong output when i am giving Variable input to math function

12 views (last 30 days)
When i am running Matlab mfile with single input i am getteng correct output values, but when i am converting that code into math function and giving variable inputs from pmus data in sim power system i am getteng wrong output values, can anyone suggest how to resolve it.

Answers (1)

Atharva
Atharva on 4 Sep 2023
Hey Venkateswararao,
When you have a MATLAB script (.m file) that works correctly with single input values but encounters issues when converted into a MATLAB function that takes input from power system data, there could be several reasons for the discrepancy in output values. Here are some steps you can take to troubleshoot and resolve the issue:
  1. Data Format and Preprocessing: Ensure that the input data from the power system (PMUs data) is correctly formatted and preprocessed to match the expected input format of your MATLAB function.
  2. Variable Naming and Scope: Check that variable names and scope are consistent between your MATLAB script and the MATLAB function. Variables used within the function should match those used in the script.
  3. Function Input Arguments: Confirm that the input arguments of your MATLAB function match the number and type of inputs required by your original script.
  4. Variable Initialization: Verify that all variables used within the function are properly initialized. MATLAB functions often require explicit variable initialization, while scripts may rely on the order of execution to set values.
  5. Input Data Verification: Check the input data from the power system for anomalies, missing values, or outliers that may cause unexpected behavior in your function.
I hope it helps!

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!