how can ı solve 'Not enough input arguments.' error?
조회 수: 7 (최근 30일)
이전 댓글 표시
function resim = Inverse_Filtering(ifbl, LEN, THETA, handle)
%Function to restore the image using Inverse Filter
%Inputs: ifbl, LEN, THETA.
%Returns: resim.
%
%ifbl: It is the input image.
%THETA: It is the blur angle. The angle at which the image is blurred.
%LEN: It is the blur length. The length is the number
% of pixels by which the image is blurred.
%handle:It is the handle to the waitbar(progress bar).
%resim: It is the restored image.
%
%Example:
% resim = Inverse(image, LEN, THETA);
% This call takes image, blur length & blur angle as input
% and returns the restored image.
%No of steps in the algorithm
steps = 6;
%Converting to frequency domain
fbl = fft2(ifbl);
waitbar(1/steps, handle);
%Create PSF of degradation
PSF = fspecial('motion',LEN,THETA);
waitbar(2/steps, handle);
%Convert psf to otf of desired size
%OTF is Optical Transfer Function
OTF = psf2otf(PSF, size(fbl));
waitbar(3/steps, handle);
%To avoid divide by zero error
for i = 1:size(OTF, 1)
for j = 1:size(OTF, 2)
if OTF(i, j) == 0
OTF(i, j) = 0.000001;
end
end
end
waitbar(4/steps, handle);
%Restoring the image using Inverse Filter
fdebl = fbl./OTF;
waitbar(5/steps, handle);
%Converting back to spatial domain using IFFT
resim = ifft2(fdebl);
waitbar(6/steps, handle);
댓글 수: 2
Stephan
2018년 4월 25일
function resim = Inverse_Filtering(ifbl, LEN, THETA, handle)
%Function to restore the image using Inverse Filter
%Inputs: ifbl, LEN, THETA.
%Returns: resim.
%ifbl: It is the input image.
%THETA: It is the blur angle. The angle at which the image is blurred.
%LEN: It is the blur length. The length is the number
% of pixels by which the image is blurred.
%handle:It is the handle to the waitbar(progress bar).
%resim: It is the restored image.
%Example:
% resim = Inverse(image, LEN, THETA);
% This call takes image, blur length & blur angle as Input
% and returns the restored image.
%No of steps in the algorithm
steps = 6;
%Converting to frequency domain
fbl = fft2(ifbl);
waitbar(1/steps, handle);
%Create PSF of degradation
PSF = fspecial('motion',LEN,THETA);
waitbar(2/steps, handle);
%Convert psf to otf of desired size
%OTF is Optical Transfer Function
OTF = psf2otf(PSF, size(fbl));
waitbar(3/steps, handle);
%To avoid divide by zero error
for i = 1:size(OTF, 1)
for j = 1:size(OTF, 2)
if OTF(i, j) == 0
OTF(i, j) = 0.000001;
end
end
end
waitbar(4/steps, handle);
%Restoring the image using Inverse Filter
fdebl = fbl./OTF;
waitbar(5/steps, handle);
%Converting back to spatial domain using
IFFT resim = ifft2(fdebl);
waitbar(6/steps, handle);
end
답변 (3개)
Fangjun Jiang
2018년 4월 25일
If a function requires two input arguments but you provided only one, you'll get this error. Try:
strcmp('a','b')
strcmp('a')
The message will tell you which line of code caused the error. So follow the code and check the number of input arguments.
Ahmet Cecen
2018년 4월 25일
You named your variable handle, and probably didn't define it. handle is already defined in MATLAB so it thinks that your trying to call the function "handle" instead of referring to the specific handle you want.
Firstly, if you wanted to use your code as is, you would call it like this (note the "h" variable instead of "handle"):
h = waitbar(0,'Example')
resim = Inverse_Filtering(rand(11), 3, 30, h)
But, this makes no sense to me. Just get rid of the handle all together by modifying your code here (I am keeping the name "handle" but I advise you to change it, and do so everywhere in the function):
function resim = Inverse_Filtering(ifbl, LEN, THETA)
%... Same Code Here
%Converting to frequency domain
fbl = fft2(ifbl);
handle = waitbar(1/steps,'Example');
%... Same Code Here
end
Now you can just call:
resim = Inverse_Filtering(rand(11), 3, 30)
Pyaidipati vamsi
2024년 2월 25일
function [receiver_position, distances] = calculate_receiver_position(pseudoranges, ephemeris_data, clock_bias)
% Check input dimensions and consistency
% ... (Your code here)
% Initialize variables
receiver_position = [0; 0; 0]; % Initial guess for position
distances = zeros(size(pseudoranges));
% Loop through each satellite
for i = 1:length(pseudoranges)
% Extract satellite position from ephemeris data
satellite_position = get_satellite_position(ephemeris_data(i, :));
% Calculate geometric distance based on pseudorange and satellite position
% ... (Implement your chosen algorithm here)
% Update distances and receiver position based on calculations
distances(i) = calculated_distance;
% ... (Update receiver position using calculated values)
end
% Refine receiver position using chosen algorithm (optional)
% ... (Implement your chosen iterative method here)
end
% Function for extracting satellite position from ephemeris data
% ... (Implement your logic to extract position based on your data format)
댓글 수: 1
참고 항목
카테고리
Help Center 및 File Exchange에서 CubeSat and Satellites에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!