Answered
hello, i'm working on following assignment. it works and gets the correct roots, but i'm supposed to set up inputs a and b as an array containing initial bracket,
Is this what you mean? function [root,value,err,itr] = bisectionMethod(f,interval,TOL,imax) a = interval(1); b = ...

4 years ago | 0

| accepted

Answered
Unrecognized function or variable 'quad8'
As mentioned in the answer here (with plenty of reference links in it): https://www.mathworks.com/matlabcentral/answers/301131-...

4 years ago | 0

Answered
How do I rectify the following code so that it produces an actual 3D plot?
Modified comment to exclude lower bounds, posted as answer here: clear clc close all % (0.2<a) & (a<=1); % (0.25<b) & (b<=1...

4 years ago | 0

Answered
Sort repetition in text
Text = 'KKKKLLOOKkl'; [C,~,Xz] = unique(Text,'stable'); idx = [true; diff(Xz) ~= 0]; strcat(sprintfc('%d',diff([find(idx);...

4 years ago | 0

| accepted

Answered
How to Loop on Different SNR values in MATLAB
Looks like you have it essentially right; you just need to use the decimal specifier %d (or %03d or whatever makes sense) rather...

4 years ago | 0

| accepted

Answered
How do i take complex number inputs in matlab appdesigner?
A NumericEditField cannot be used for complex numbers. From the documentation: MATLAB rejects the value if: It cannot convert ...

4 years ago | 0

Answered
How to change this code to 3D wave propagating animation?
Your y_tt is a 2D matrix, with one dimension corresponding to time and one dimension corresponding to x, a spatial dimension pre...

4 years ago | 1

| accepted

Answered
how to do scatter plot and color code the values?
Here's an attempt (basically the same as what @Adam Danz said, if I understand correctly): S = load('matlab.mat'); Ivec = [cos...

4 years ago | 1

| accepted

Answered
Problem multiplying exponential function with negative value
This statement x(t) = t.*(exp(-0.15*t)); says to set the value of x at indexes given by t to the expression on the right-hand ...

4 years ago | 1

| accepted

Answered
How can I draw a 2D filled contour onto an arbitrary surface in 3D space?
Since the contour has LineStyle 'none' you can use a surface object and specify the XData, YData, ZData directly (no need for a ...

4 years ago | 1

| accepted

Answered
Subtracting two values that are very small
R1 and R2 are equal, so their difference is in fact 0 everywhere. R1 = [0.00212278260869565 0.00212931740869565 0.0021358539826...

4 years ago | 1

| accepted

Answered
Cannot change title of a saved figure." Unable to perform assignment because dot indexing is not supported for variables of this type."
I'm not sure what causes that error, but here's a workaround: S = load('Hermle C800 G0 Vorschub -X.fig','-mat'); f = S.hgM_070...

4 years ago | 0

| accepted

Answered
how can I plot this point on my area subplot
I don't have your data, but one way to do it is to use hold on so both the area and the point are shown simultaneously, and put ...

4 years ago | 0

| accepted

Answered
Creation of figure using multiple error bars for the same data series
Maybe try creating the min/max bars first, then the 2x std, then the std, so that the tallest bars are on the bottom and the sho...

4 years ago | 0

Answered
This question related indexing and loop , but i did not get why it need indexing?
To me the graph for part b looks like exactly what you would expect: same as part a for the first 4 hours and then a jump up wit...

4 years ago | 0

Answered
why am I getting "Array indices must be positive integers or logical values"
You were indexing Fs with a vector that had a 0 in it. Looks like you meant to be multiplying Fs by that vector instead: clear ...

4 years ago | 0

| accepted

Answered
not able to change variable names of my table
Maybe the best you can do in this case is to follow the advice of the error message: Ma = randn(100,1); T = randn(100,1); P =...

4 years ago | 0

Answered
Move an element in a vector
cellfun()'s not got an explicit loop: v = 1:5; M = cell2mat(cellfun(@(x,idx)[x(idx) x(1:idx-1) x(idx+1:end)], ... num2cel...

4 years ago | 1

Answered
My for loop calculating heading seems to be outputting only zeros to the table in app designer, not sure why
I believe the problem is that none of the conditions in the if/elseif/elseif block are ever true, so app.headingtable doesn't ge...

4 years ago | 0

| accepted

Answered
array operation in matlab
FF_liter_ho_ = [NaN 773.5 NaN NaN NaN NaN NaN NaN NaN 773.5]; % number of elements greater than 770: nnz(FF_liter_ho_ > 770)...

4 years ago | 0

Answered
Two histograms with different x axis /values
% some data: A = 12*randn(1,100)+50; B = 300*randn(1,1000)+1250; % some histograms from the data: histogram(B); hold on hi...

4 years ago | 0

| accepted

Answered
Can't integrate exponential function
Telling integral() that the function is array-valued seems to work ok: myFunc = @(x) (exp(x)/x); y = integral(myFunc,3.5,4.5,'...

4 years ago | 0

Answered
How can I take one integer and display whether it is even or odd.
Here's one way to do it. This method does not use an if statement, however. x_in = input('x: '); x = x_in; s = sign(x); whil...

4 years ago | 0

Answered
How do I add legends to my plot?
Could be because each call to plot() creates 2 lines. Check it out: plot(magic(2),'b','DisplayName','Magic'); legend() You ca...

4 years ago | 1

Answered
Making a Grantt chart, labeling individually based on vector
D = [1,1,5;2,1,3;3,4,6;4,3,6;5,1,3;6,6,11]; B = [3,6,1,2,4,5]; hBar = barh(D, 'stacked'); hBar(1).Visible='off'; hBar(3).Vis...

4 years ago | 1

| accepted

Answered
how do i mute/delete a time slot Dt on a given sample using the following expression?: dt: from sample number (N/2+N+100) to sample number (N/2+N/30)
Essentially, it's this: N = 900; data = randn(1,N); % some random data % to "mute" data samples: data(N/2+N+100:N/2+N/30) ...

4 years ago | 0

| accepted

Answered
using For loop function to find the sum of the number
Well, if the question were how to find the sum of the _even_ numbers between 2 and 102, inclusive, using a for loop, you could s...

4 years ago | 1

Answered
How to plot graphs at distance
Try it like this: figure(1) [rows,cols] = size(data); time = data(:,1); for ii = 2:cols z = data(:,ii); distance =...

4 years ago | 1

| accepted

Answered
how to write to one decimal point from matlab to excel
You could convert those numbers to strings before writing, if you don't mind rounding to one decimal place rather than truncatin...

4 years ago | 0

Answered
lat= 10848x10848 double and lon= 10848x10848 double. How to make spatial map with this ?
If they are in a form as you'd get from meshgrid(), then you can easily make a spatial map using surf() among other functions. (...

4 years ago | 1

Load more