how can ı solve 'Not enough input arguments.' error?

1 Ansicht (letzte 30 Tage)
Baris Altunhan
Baris Altunhan am 25 Apr. 2018
Kommentiert: Walter Roberson am 25 Feb. 2024
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 Kommentare
Stephan
Stephan am 25 Apr. 2018
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
Baris Altunhan
Baris Altunhan am 25 Apr. 2018
ıt is not working mr stephan,did you check your codes? ı tried to work but it is not working , help me please ..

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Fangjun Jiang
Fangjun Jiang am 25 Apr. 2018
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
Ahmet Cecen am 25 Apr. 2018
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)
  1 Kommentar
Baris Altunhan
Baris Altunhan am 25 Apr. 2018
ıt is not working ahmet, what am ı gotta do for correcting this? ıf you fixed this can you send me correct codes?

Melden Sie sich an, um zu kommentieren.


Pyaidipati vamsi
Pyaidipati vamsi am 25 Feb. 2024
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 Kommentar
Walter Roberson
Walter Roberson am 25 Feb. 2024
I do not understand how this solves the problem given in the question?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu CubeSat and Satellites 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!

Translated by