Why does my function not return a figure when there is no error but when there is it returns a figure?

4 days ago | 0

Time arithmetic (no dates)
tdiff = (hours(4)+minutes(30)) - (hours(2) + minutes(45)) [h, m, s] = hms(tdiff)

4 days ago | 2

| accepted

Can anyone please help me out to obtain frequency Modulated wave from a Phase Modulator using pmmod function in matlab?
fs = 50; t = (0:2*fs+1)'/fs; x = sin(2*pi*t) + sin(4*pi*t); fc = 10; phasedev = pi/2; tx = pmmod(x,fc,fs,phasedev); ...

4 days ago | 0

its ask to prelocate speed on p line. why?
Why? In most circumstances, MATLAB does not examine the context to figure out how many iterations of a loop will be done, and s...

4 days ago | 0

| accepted

How to find a proper algorithm to solve this optimal control problem?
You did not say what you wanted to optimzie with respect to. If you wanted to optimize with respect to u, then see solu below. ...

4 days ago | 0

Unrecognized function or variable 'gca'
Summarizing: gca was being assigned to as a variable. With current versions of MATLAB, if you assign to a variable that has the...

4 days ago | 1

| accepted

I am trying to find values of four constants from four equations. Yet the code is unable to give out values
When I try your code, I get all 0 for the constants. When I go through step by step from the equations, I get the same result...

5 days ago | 0

| accepted

Unrecognized field name in solving symbolic matrix
You did not specify which variables to solve for, and you have more variables than equations. solve() choose variables to solve ...

5 days ago | 0

| accepted

How to fit an uniform distribution to a histogram?
https://www.mathworks.com/help/stats/prctile.html Calculate the 98th prctile of the counts; that corresponds to 2 standard dev...

5 days ago | 0

Errors while trying to setup equation for root finding.
syms a k_pdo x_pdo x_glycerol z_pdo z_glycerol k_glycerol k_water x_water z_water eqn1 = x_pdo == z_pdo/(1 + a*(k_pdo - 1)); e...

5 days ago | 0

You will need to contact Mathworks for pricing for that particular product. Note: HDL Coder is not available for Student licen...

6 days ago | 0

| accepted

How does Matlab perform large integer modular arithmetics using Symbolic Math Toolbox?
S1 = char(evalin(symengine, 'expose(symobj::powermod)')); S1 = regexprep(S1, '\\n', '\n') S2 = char(evalin(symengine, 'expose(...

6 days ago | 0

Explanation for : Warning: Integer operands are required for colon operator when used as index. > In welch>localComputeSpectra (line 379)
Your No variable corresponds to the overlap which is required to be a positive integer according to the documentation. However w...

6 days ago | 0

Is this a bug? different results when performing simple math operation (A * (B - C)) with scalars or variables
If you use format long g you will see that ptfDur is not exactly the same as the constant 4.5501 . For example, test ptfDur -...

6 days ago | 1

| accepted

How to stop result being rounded - Symbolic mathematics
No problems here. syms t positive %Describe the voltage and current functions v=(10000*t+5)*exp(-400*t); i=(40*t+0.05)*exp(-...

6 days ago | 0

| accepted

Matlab getting stuck , no output
function [hist,searchdir] = runfmincon hist.x = []; hist.fval = []; searchdir = []; x0 = [0.3 0.02 0.2]; lb = [0.2 0.0...

6 days ago | 0

Save Figure Using First Subplot Name
FigName = ax(end).Title.String; The first axes created in the figure will be the last axes object in Children order (unle...

6 days ago | 0

Android project directory path name exceeds the 119 character
Quit MATLAB (for the moment) Rename C:\Users\Guilherme\Documents\MATLAB to a shorter name, such as C:\Users\Guilherme\Documents...

6 days ago | 0

how do i automatically select the kernel size like 5*5, 7*7... instead of the 3*3 in the code below
window_size = randi([2 6]) * 2 - 1 hws = (window_size - 1)/2; es = imread('cameraman.tif'); assert(ndims(es) == 2, 'Grays...

6 days ago | 0

I am a beginner-level programmer. Kindly help me to count the number of images from multiple folders at once
dinfo = dir(fullfile('*', '*.jpg')); folders = {dinfo.folder}; [~, basefolder] = fileparts(folders); [G, folder_name] = findg...

7 days ago | 0

| accepted

How can I define bin edges for histogram?
edges = linspace(40, 80, 8+1)

7 days ago | 0

| accepted

program is not showing graph
You have function y=f(x,theta) You are passing in a variable named x k0=(2*pi/0.6328)*1e6; That's a value in the millions n...

7 days ago | 0

What would be the MatLab code to get the output from the input image?.
colidx = sum(cumprod(~cellfun(@isempty, INPUT), 2),2) + 1; OUTPUT = INPUT(sub2ind(size(INPUT), 1:size(INPUT,1), colidx)); This...

7 days ago | 0

| accepted

MATLAB Curve fitting with custom equation (max/min)
You can bind it in using an anonymous function; http://www.mathworks.com/help/matlab/math/parameterizing-functions.html However...

7 days ago | 0

Before if mainList=='temperature' if innerList1=='Celsius' if innerList2=='Fahrenheit' insert mainList_options ...

7 days ago | 0

| accepted

How can we continuously save the mouse tracking positions with respect to time in workspace
https://matlab.fandom.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F

7 days ago | 0

| accepted

Reformat table with a column as a top row
You can get the Tvalue / PValue to be the same by making each variable in the table be a table itself. However, there is no way...

7 days ago | 0

Error in using eval statement
Asking how to use eval without problems is like asking how to use a chainsaw without its chain guard. It would be irresponsible ...

7 days ago | 0