Answered
Overlay contourf plot to a JPEG
It is better to plot the contourf plot on the image. First read the image using imread. Plot the image with your desired tagg...

4 years ago | 0

Answered
Ploting 3 D cube or graph with pressure
REad about slice. https://in.mathworks.com/help/matlab/ref/slice.html#:~:text=slice(%20V%20%2C%20xslice%20%2C%20yslice%20%2C%2...

4 years ago | 0

Answered
Function returns scalar independent of input, but I need a matrix output
clc; clear all ; f = @(x1, x2)4.3206303272e-05.*x1.^2+2.39837699915e-05.*x2.^2 ; f(1,0) f([1:4]', [5:8]') f(rand(3,1),rand...

4 years ago | 0

Answered
Can someone help me explain this code?
You can get it yourself, by reading the respective functions documentation. fs = 48000; % smapling frequency f0 = 2000; ...

4 years ago | 0

Answered
How to Plot the smooth envelope of 3D scattered points
Read about griddata and/or scatteredInterpolant.

4 years ago | 0

Answered
Contour3D temperature (xyz data) on a river bathymetry
You need to read about griddata or scatteredInterpolant. These are the function you are supposed to use.

4 years ago | 0

Answered
How to concatenate first column of matrix A and first column of matrix B, then second column of matrix A and second column of matrix B and so on?
A = rand(128,4626); B = rand(128,4626); [m,n] = size(A) ; iwant = zeros(m,2*n) ; iwant(:,1:2:end) = A ; iwant(:,2:2:end)...

4 years ago | 1

Answered
Spherical Patch in 3D
The shape is spherical and looks fine. You need to set the axis. Try axis equal at the end.

4 years ago | 0

Answered
Plotting in 3D, based on beta and alpha.
I strictly advice you to check your formul for P_o1. %basic assumption/variables g = 9.81; %Gravity con...

4 years ago | 1

Answered
Integral error in the function
func=@(t) (t.^((3/2)-1).*(exp(-t))); %<-- element by element operations Gamma=integral(func,0,Inf)

4 years ago | 0

Answered
Plot a temperature matrix
REad about pcolor.

4 years ago | 1

| accepted

Answered
Extracting strings in a cell array that contain certain characters
There woul dbe definitely better optimal way then this. str = [{'gamer'} {'macho'} {'mages'} {'grail'}] ; letters = {'a' '...

4 years ago | 0

Answered
char(2713) and fprintf('\x2713\n') don't show a checkmark in the command window
How about using sprintf. s = sprintf('\x2713')

4 years ago | 2

Answered
I want to make 4 clusters using k mean clustering and for each of the 4 clusters i want to set centroid initially and then accordingly make the cluster. how can I.
X3=[-6.189; -3.251; 2.926; 6.534; 10.79; 5.203; -4.465; 1.42; -8.66; -0.8748; 6.534 ; 11.251] ; Y3=[ 1.393; 10.42; 6.639; 5.8...

4 years ago | 0

| accepted

Answered
Creating a Matrix of functions
You have to modify your code line hsown below: x=.49; y=3; f1=1/2*sin(x*y)-y/4/pi-x/2; f2=(1-1/4/pi)*(exp(2*x)-exp(1))+exp...

4 years ago | 0

Answered
Reading a massive file but skipping several lines / rows at a fixed interval
id = 1:9 ; % line numbers V = 1990:2000:9990 ; % give the end wisely idx = id'+V ; % make indices idx = idx(:) ; % mak...

4 years ago | 0

| accepted

Answered
group data every 10 days(decade)?
Convert your dates into datetime or datevec. From this you can get the year, month, day etc.....from day data array, use ismembe...

4 years ago | 0

| accepted

Answered
Shade area under two lines
x = linspace(0,5) ; y1 = (4-x)/2 ; y2 = (6-3*x)/2 ; x = [x flip(x)] ; y = [y1 flip(y2)] ; patch(x,y,'r')

4 years ago | 0

Answered
When i run the blow code, the loop gets stuck on the underline line and it says that the indices on the left are not compatible with the indices on the right.
clc clear all sigma1=0.002; sigma2=-0.003; tau_12=0.004; E1=181; E2=10.3; mu_12=0.28; G12=7.17; tetha=1:90; c=cosd(tet...

4 years ago | 1

Answered
How to do distance formula
If(x1,y1) and (X2,y2) are two points. To get the distance use the formula: d = sqtrt((x2-x1)^2+(y2-y1)^2) ;

4 years ago | 1

Answered
How do I make an array, (m,n), where the first row corresponds to the row number, where the first column corresponds to the column number, and the remaining elemnts by adding
m = 5; n = 4 ; A = zeros(m+1,n+1) ; A(1,2:n+1) = 1:n ; A(2:m+1,1) = 1:m ; for i = 1:m for j = 1:n A(i+1,j+1)...

4 years ago | 0

| accepted

Answered
How to find a value in column 2 which corresponds to particular value in column 1?
A=[1 3 7 9 4 5 3 2 4; 2 3 1 3 4 5 9 2 4] ; idx = A(1,:)==9 iwant = A(2,idx)

4 years ago | 0

Answered
How to plot this function?
What have you attempted for this simple question? Read about linspace or : Read about exp Read about plot Read about hold o...

4 years ago | 0

Answered
User input changes circle radius and velocity
You are using the radius while calculating the coordinates of circle. v=input('Please provide a particle velocity: \n'); r=in...

4 years ago | 1

Answered
The meaning of code on this program
clear, close all I = imread('pout.tif'); % this is to read the image pout.tif for i = 1:size(I,1) % this is loop from 1 to ...

4 years ago | 1

| accepted

Answered
Can you have a if statement for even/odd?
n = 1 ; if ~mod(n,2) fprintf('Even\n') else fprintf('Odd\n') end

4 years ago | 2

Answered
eroor in lstm training network
I think this line: numFeatures=2 shoule be numFeatures=1

4 years ago | 0

Answered
remove duplicates from matrix and create a logic to index
REad about the function unique. time = [1 2 2 3 4 4 5 6 6 7 8 ]' ; [c,ia,ib] = unique(time) ; data = data(ia) ;

4 years ago | 0

| accepted

Answered
How to Detect shape and number of shapes in image
I = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/940849/im_005001%20(1).png') ; I1 = imbinarize(I) ; ...

4 years ago | 0

Answered
Surface Plot in Sum Series
h=2; v=2; l=2; a = linspace(-5,5,100); b = linspace(-5,5,100); [x, t]=meshgrid(a,b); m = 1000 ; for i = 1:m f...

4 years ago | 1

| accepted

Load more