How to apply Least square adjustments on images.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
psf=mat2gray(imread(‘psf.tif'));
psf_profile=psf(18,:);
fitp = fminsearch(@(x) D1Resids(x,inputdata),[17,3,.04,.01]);
I get this error:
??? Undefined function or variable 'inputdata'.
Error in ==> @(x)D1Resids(x,inputdata)
Error in ==> fminsearch at 205 fv(:,1) = funfcn(x,varargin{:});
3 Kommentare
Geoff Hayes
am 2 Mai 2014
Tanya - I don't have access to the D1Resids.m function/file so I can't tell you what it should be. All I could find was a pdf ( http://www.rpgroup.caltech.edu/courses/PBL/bootcamp2011/protocols_and_references/AdvancedMatlabTutorial.pdf) that seems to have the same code as what you pasted above in your question.
If you want, you can post the D1Resids.m file to your question and I (or someone else) can review it to try and figure out what the inputdata should be.
Antworten (1)
Prateekshya
am 21 Okt. 2024
Hello Tanya,
The error message you are encountering indicates that the variable inputdata is undefined when you are trying to use it in the fminsearch function call. This typically happens when the variable inputdata has not been initialized or is not in the workspace when fminsearch is called. Here is how you can resolve this issue:
- Define inputdata: Ensure that inputdata is defined before you call fminsearch. inputdata should contain the data that your residual function D1Resids needs to operate.
- Check Variable Scope: Make sure that inputdata is in the correct scope. If you define inputdata inside a function, it won't be available to fminsearch unless passed explicitly.
- Example Initialization: If inputdata is supposed to be derived from psf_profile or another source, make sure to initialize it properly.
- Check File Path: Ensure that 'psf.tif' is in the correct directory or provide a full path to the file.
- Residual Function: Make sure the function D1Resids is correctly defined and accessible. It should compute the difference between your model predictions and the data in inputdata.
- Debugging: Use disp or fprintf to print variables and check their values before the optimization step to ensure everything is set up correctly.
I hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!