Answered
I need help with a morphing program.
function morphShapes numShapes = 9; numFrames = 100; colors = rand(numShapes, 3); % random colours for each sha...

2 years ago | 0

Answered
How to find the gradient of plotted values?
% Dummy values for T, D, and v w = 5000; % Constant weight v = linspace(100, 300, 100); % Velocity vector ranging from 100 t...

2 years ago | 0

Answered
Force variable name in code generation
% Example MATLAB function function Foo(myVar) %#codegen % Your code here end % Code generation configuration cfg...

2 years ago | 0

Answered
Keep parpool open instead of open/close for each iteration. Possible?
@Mario Malic A basic approach. Let me know if it helps. Thanks. % Initialize the parallel pool poolObj = gcp('nocreate'); % If...

2 years ago | 0

Answered
retime timetable based on custom definition of year
% Load the .mat file containing the timetable loadedData = load('matlab.mat'); % Replace with your actual .mat file path % ...

2 years ago | 0

| accepted

Answered
Keep parpool open instead of open/close for each iteration. Possible?
% Initialize the parallel pool with the desired number of workers % Ensure this number does not exceed the maximum number of ...

2 years ago | 0

Answered
secant method in matlab
R = 3; V_desired = 30; % Desired volume x1 = 4; % Initial guess x2 = 3; % Second initial guess number_iterations = 50; ...

2 years ago | 0

| accepted

Answered
How to Save Values to a Variable Passing through a Loop
% Assuming Depth, Xpos, and Ypos are defined elsewhere % Initialize LargeBunny with zero rows and three columns LargeBunny =...

2 years ago | 0

Answered
Pulsating High Freq Observer
Vector Space: In an IPMSM, the stator currents and voltages can be represented in a vector space (commonly referred to as the ...

2 years ago | 1

| accepted

Answered
Calculate angles correctly between two vectors using the dot product.
% Close all figures and clear variables close all; clear all; % Define the reference vector L = [-0.5 -0.5]; % Define...

2 years ago | 0

Answered
Problem in solving matrix diiferential equation using ode45?
% Define matrices M, C, K, and vector F (Use your actual matrices and vector here) M = [...]; C = [...]; K = [...]; F = [....

2 years ago | 0

Answered
Unable to create file when using pyrunfile
Current Working Directory: The MATLAB and Python environments may have different current working directories. The Python script ...

2 years ago | 1

Answered
How to use VARARGIN with two types of input?
Example 1: Without using varargin One array will be for the rotational inertias and the other for the corresponding angular vel...

2 years ago | 1

| accepted

Answered
output of the function used in ode113
Integrates a state using ode113 and then extracts the last value of Xdot calculated by ode113 using the derivative function. Not...

2 years ago | 0

| accepted

Answered
How to construct complext web URL using matlab.net.http
% Base URL apiURL = 'https://catfact.ninja/fact'; % Change it as per your requirements % Create a URI object from the base...

2 years ago | 0

Answered
Plotting fourier series partial sums
To compute and plot the partial sums of a Fourier series based on the coefficients you've provided (A0 = 0.9, An = 0, and Bn giv...

2 years ago | 0

Answered
Calculate pressure gradient between two areas?
% Initialize zonal1 and zonal2 structures zonal1 = struct(); zonal2 = struct(); % --- Zonal 1 Data Preparation --- % C...

2 years ago | 0

Answered
My gradient function wont update in my for loop
clear all clc clf % Constants h=3; E=1; Area=1; L=sqrt(1+h^2); x1=-1; y1=h; x2=1; y2=h; x3=0; y3=0; % Define the lengt...

2 years ago | 0

| accepted

Answered
Play a sound with a specific timing
To minimize the delay, you can use more precise timing functions available in MATLAB, like Psychtoolbox, which is often used in ...

2 years ago | 1

Answered
How to clear serial port buffers from matlab to arduino?
@颖 韩 MATLAB Script: This script sends a new piece of data to the Arduino every second. It assumes the Arduino is set up to rea...

2 years ago | 0

| accepted

Answered
How to clear serial port buffers from matlab to arduino?
% Create a serial port object connected to the Arduino device = serialport("/dev/cu.usbmodem2101", 9600); % Write an arr...

2 years ago | 0

Answered
How to find image region if coordinates are provided?
A simple example to guide you through the process: % Let's assume img is your image matrix and lipCoords is an Nx2 array of ...

2 years ago | 0

| accepted

Answered
How to impose coordinates to few graph nodes and reconstruct the missing ones
@Marco Rossi Try this and let me know. Thanks. s = [1 1 3 4 1]; % starting point of edges t = [2 3 4 5 5]; % terminal po...

2 years ago | 0

Answered
Automatically change the input arguments of function handles
you can design a higher-order function—a function that returns other functions—to achieve the flexibility you're looking for. L...

2 years ago | 0

Answered
How to impose coordinates to few graph nodes and reconstruct the missing ones
Suppose x and y are your known coordinates and v are the values at those coordinates (which could be some metric related to the ...

2 years ago | 0

Answered
Display numeric value before function with using syms
syms t; u = symunit; % Define symbolic unit system current = vpa(0.002*sin(10^3*t)); % Create a symbolic expression % App...

2 years ago | 0

Answered
mex is configured to use Microsoft visual C++, but when running the code it builds using MINGW64 compiler why?
Verify Compiler Configuration: Run mex -setup C++ in the MATLAB Command Window to check which C++ compilers are available and t...

2 years ago | 0

Answered
Filter rows and columns (find)
@Augusto Gabriel da Costa Pereira Made some changes. Try this out and let me know. Thanks. clc; clear; % Load your latitude ...

2 years ago | 1

| accepted

Answered
Plotting Fourier Series (first 5, 15, 25 partial sums, (3 Plots))
Assuming you get the formula for bN​ (odd), here's one of the approach you can use in MATLAB: % Define the basic parameters ...

2 years ago | 1

Answered
Calculation of R,L,C, Zs of 3 phase transmission lines
Below is a basic guide on how you might structure this calculation: % Three-Phase Transmission Line Parameters Calculation %...

2 years ago | 0

Load more