I nee to write a code to solve a definite integral. The output format has to be fprintf.
syms x % f = -x.^3 + 3.x^2 - 2; % ^ this . should be * f = -x.^3 + 3*x^2 - 2; a=0; b=3; output = int(f, a, ...

5 days ago | 1

How to select consecutive rows at regular intervals?
% a matrix with 1000 rows and 5 columns M = (1:1000).'+(0:4) One way: A = M((20:50).'+(0:50:end-50),:); disp(A) Another w...

5 days ago | 0

| accepted

when and how to use dot multiplication
"but is .* needed in my above q equation?" Yes. t is a vector, and q0, R, L, and C are all scalars. q0=10;R=60;L=9;C=0.0005; ...

5 days ago | 1

How many legs 100 cows have
n_legs_per_cow = 4; % one cow has 4 legs n_cows = 1000; % 1000 cows n_legs_total = n_cows*n_legs_per_cow

5 days ago | 0

Error message "Index exceeds the number of array elements. Index must not exceed 3"
fsp is the cell array, and fsp{1,1} is the vector contained in the first element (first cell) of fsp. You are taking the length...

5 days ago | 0

| accepted

plotting title with multiple strings on one line
str_cell_array = {"abc\_def.h5" "ghi\_jkl.h5"}; str_title = strjoin(string(str_cell_array)," and ") title(str_title); figur...

5 days ago | 0

| accepted

Applying one function in another function
CreateNeighbor() function sol = CreateRandomModel() sol = struct( ... 'sum_fburn_rand',rand(), ... 'fburn_rand',ra...

5 days ago | 0

May the number of decimal point be related with errors in matlab by using inpolygon and ismember functions?
"I am asking how it is possible?" MagnitudesOfEventsInAreaSource1{i} can have more than NumofeqsinArea1{i} elements if Catalog ...

5 days ago | 0

| accepted

replace specific empty columns by 0 in cell MATLAB?
% reproduction of your cell array: C = repmat({NaN},7,15); C(1:4,11:15) = {0}; C(5:7,5:15) = {0}; C{1,1} = '0.x'; C{2,2} = ...

5 days ago | 0

| accepted

interpreter with backlash underscores
The easiest way to fix this might be not to use an interpreter: subplot(2,1,1) xlim([-1 1]) set(gca(),'XTick',0,'XTickLabels'...

5 days ago | 0

| accepted

How to disable figure pop up while initializing hggroup?
hggroup() creates an hggroup in the current axes in the current figure. If there is no current figure, then a new figure is cre...

5 days ago | 0

Use only a certain range of values for a function
truncated_z = z(t_z <= 3);

5 days ago | 0

| accepted

Matching columns of arrays to fill up a corresponding empty column

5 days ago | 1

I can't seem to call an integral function inside of a plot that has any complexity. I need to plot outputs of a range of values for the integral.
You're calling int with two different sets of inputs and asking why one works and one doesn't, right? The line: plot(x,Wthr.P_...

5 days ago | 0

I don't think this will work for every premade plot, but it seems to work for plots created with rlocus H=tf([1],[1 1]); rlocu...

5 days ago | 1

| accepted

I would like to mark the Minima of my colormap (scatter plot), because the Minima is not directly apparent.
% some random data for demonstration: ff_r = 100*rand(50,1); ff_g = 100*rand(50,1); saved_data = rand(50,1); plotted_data = ...

5 days ago | 0

Extracting data range from array problem
sampTurns = 5; ipArray=csvread('accel test drive 1.csv'); col1 = ipArray(:, 1); [peaks,peakIdx] = findpeaks(col1,'MinPeakDi...

5 days ago | 0

| accepted

How to get column values using indexes
S = load('matlab.mat'); A = S.Dataset23; result = splitapply(@(x){x(:,1:4)},A,findgroups(A(:,5)))

5 days ago | 0

How to stop seperate axes plotting over the top of one anotner?
One way would be to plot into a new figure each time, instead of specifying to plot into figure 1 each time: x = [-10:1E-3:10];...

5 days ago | 0

| accepted

limit the search for maximums to a specific region
Instead of inputting the entire array into findpeaks, you can simply input the part of the array you want to search, and then ad...

5 days ago | 0

| accepted

Does somebody know how to plot this function?
Use tand rather than tan, because the argument 3*x is in degrees rather than radians. Increase the number of points to see the ...

7 days ago | 1

| accepted

Unable to use a value of type cell as an index
Maybe the function compact_bbox defined below is close to what you have in mind. bbox_cell = { ... 'img1' [1 2 3] 'pothole...

7 days ago | 0

| accepted

Legend of a plot out of table first row
I'm not sure where the legends are supposed to fit, but here you go: S = load('PegelpunktetimeseriesneuCopy'); Pegelpunktetime...

7 days ago | 0

Sort array of strings after criteria in the middle of each string
str = ["xer_cQwe" "po_bLo" "te_aUc"]; [~,idx] = sort(extractAfter(lower(str),'_')); sorted_str = str(idx)

7 days ago | 0

how to have a message that indicates me the experiment is done?
function Next_button_Callback(hObject, eventdata, handles) % hObject handle to Next_button (see GCBO) % eventdata reserved...

7 days ago | 0

| accepted

How can I choose certain parameters to choose different ways to calculate the determinant?
Below is a function get_det, made by adapting your code, which takes a matrix as its first input and a character vector specifyi...

8 days ago | 0

Data set for papaya fruit

8 days ago | 0

Change xaxis from numbers to dates
x = 1:8760; y = x+5; figure() % plot(x,y) dt = datetime(2019,1,1,x-1,0,0); dt([1 end]) plot(dt,y) set(gca(),'XTick',datet...

10 days ago | 1

| accepted