Tag Archives: matlab
How to hide the view selection cube
How can I hide the view selection cube in multibody explorer during a simulation?
Also the Orientation Triad.How can I hide the view selection cube in multibody explorer during a simulation?
Also the Orientation Triad. How can I hide the view selection cube in multibody explorer during a simulation?
Also the Orientation Triad. multibody explorer, view selection cube MATLAB Answers — New Questions
How to connect a PID signal to a H-bridge driver
Hello, a very simple question, but how do you connect a PID to the input of a H-bridge driver? I have read the relevant documentation on the H-bridge driver and tried using a simulink-PS converter however, none of these work, please could someone show me how to do this. Thanks.Hello, a very simple question, but how do you connect a PID to the input of a H-bridge driver? I have read the relevant documentation on the H-bridge driver and tried using a simulink-PS converter however, none of these work, please could someone show me how to do this. Thanks. Hello, a very simple question, but how do you connect a PID to the input of a H-bridge driver? I have read the relevant documentation on the H-bridge driver and tried using a simulink-PS converter however, none of these work, please could someone show me how to do this. Thanks. simscape, simulink, pid MATLAB Answers — New Questions
How to display square root symbol instead of decimal.
The number of display format does not include the square, I can only select decimal, rational…, but not square root. When I input sqrt(5) in a matrix and display it, it is transformed to decimal. Can I keep the square root form?The number of display format does not include the square, I can only select decimal, rational…, but not square root. When I input sqrt(5) in a matrix and display it, it is transformed to decimal. Can I keep the square root form? The number of display format does not include the square, I can only select decimal, rational…, but not square root. When I input sqrt(5) in a matrix and display it, it is transformed to decimal. Can I keep the square root form? number display format MATLAB Answers — New Questions
How would i get acces to a object that i only know the name of?
I have this custom component that i want to make for the app designer, the issue is that i am unable to send the object in question to the custom component on creation as that isnt allowed.
This code snippet was something i tried but didnt work as its not allowed to have custom components with input parameters.
function obj = Movcomp(Scenemanager)
addlisterner(Scenemanager,’Delete’,@Movcomp.Delete)
end
i would still like to do something like this As the Scenemanager will be one or multilple objects that will create and delete different components using callbacks. I couldnt find a way to create global callbacks similair to what can be done using a singleton for signals in godotI have this custom component that i want to make for the app designer, the issue is that i am unable to send the object in question to the custom component on creation as that isnt allowed.
This code snippet was something i tried but didnt work as its not allowed to have custom components with input parameters.
function obj = Movcomp(Scenemanager)
addlisterner(Scenemanager,’Delete’,@Movcomp.Delete)
end
i would still like to do something like this As the Scenemanager will be one or multilple objects that will create and delete different components using callbacks. I couldnt find a way to create global callbacks similair to what can be done using a singleton for signals in godot I have this custom component that i want to make for the app designer, the issue is that i am unable to send the object in question to the custom component on creation as that isnt allowed.
This code snippet was something i tried but didnt work as its not allowed to have custom components with input parameters.
function obj = Movcomp(Scenemanager)
addlisterner(Scenemanager,’Delete’,@Movcomp.Delete)
end
i would still like to do something like this As the Scenemanager will be one or multilple objects that will create and delete different components using callbacks. I couldnt find a way to create global callbacks similair to what can be done using a singleton for signals in godot appdesigner MATLAB Answers — New Questions
Trying to read a text field from my Thingspeak channel (text) and display it using arduino giga display shield.
Matlab Visualization Code (works properly)
My first 3 lines of information display properly on my giga display shield.
The 4th line which is supposed to be a timestamp stored in my field as text (ex:
Displays as -1, not the text timestamp I am looking for. Any help is appreciated.
% Read the last entry and its timestamp
[data, timestamps] = thingSpeakRead(x, ‘NumPoints’, 1);
% Add a timezone offset of 5 hours
localTime = timestamps – hours(5);
% Display the local timestamp as text
text(0.5, 0.5, datestr(localTime), ‘FontSize’, 20, ‘HorizontalAlignment’, ‘center’);
axis off;
Note – sensitive info replaced with X
Arduino code
#include <WiFi.h> //library for connecting to WiFi
#include <ThingSpeak.h> //library for reading data from ThingSpeak
#include "Arduino_GigaDisplay_GFX.h" //library for using the GigaDisplay shield
//define WiFi credentials
const char* ssid = "x";
const char* password = "x";
WiFiClient client;
String textData = "";
//define ThingSpeak channel IDs and read APIs
unsigned long lakeChannelID = x;
const char* lakeReadAPI = "x";
//define GigaDisplay object
GigaDisplay_GFX display;
#define BLACK 0x0000
#define WHITE 0xFFFF
#define NEW 0xFF6B35
void setup() {
//initialize serial communication for debugging
Serial.begin(9600);
//connect to WiFi
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi…");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected!");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client); // Initialize ThingSpeak
display.begin();
}
void loop() {
float homeTemp = ThingSpeak.readFloatField(lakeChannelID, 8, lakeReadAPI);
float lakeTemp1 = ThingSpeak.readFloatField(lakeChannelID, 1, lakeReadAPI);
float lakeTemp2 = ThingSpeak.readFloatField(lakeChannelID, 2, lakeReadAPI);
float lakeTemp3 = ThingSpeak.readFloatField(lakeChannelID, 3, lakeReadAPI);
float lakeTemp4 = ThingSpeak.readFloatField(lakeChannelID, 4, lakeReadAPI);
float lakeTemp5 = ThingSpeak.readFloatField(lakeChannelID, 5, lakeReadAPI);
float lakeTemp6 = ThingSpeak.readFloatField(lakeChannelID, 6, lakeReadAPI);
String textData = ThingSpeak.readStringField(lakeChannelID,7, lakeReadAPI);
float lakeTempOutAvg = (lakeTemp1 + lakeTemp2 + lakeTemp3)/3;
float lakeTempUnderAvg = (lakeTemp4 + lakeTemp5 + lakeTemp6)/3;
long statuscode = ThingSpeak.getLastReadStatus();
if (statuscode == 200)
{
//print temperature data to serial monitor for debugging
Serial.print("Home Outside Temp: ");
Serial.println(homeTemp);
Serial.print("Lake Outside Temp: ");
Serial.println(lakeTemp1);
Serial.print("Lake Outside Average: ");
Serial.println(lakeTempOutAvg);
Serial.print("Lake Under Average: ");
Serial.println(lakeTempUnderAvg);
Serial.print("Last Read: ");
Serial.println(textData);
//clear display and set cursor to top left corner
display.setRotation(1); // -90 degrees rotation
display.fillScreen(BLACK);
display.setTextColor(NEW);
display.setTextSize( 5);
display.setCursor(50, 10); // Adjusted for rotated display
display.print("Home Outdoors");
display.setCursor(200, 60); // Adjusted for rotated display
display.print(homeTemp, 1);
display.print(" F");
display.setCursor(50, 120); // Adjusted for rotated display
display.print("Lake Outdoors");
display.setCursor(200, 170); // Adjusted for rotated display
display.print(lakeTempOutAvg, 1);
display.print(" F");
display.setCursor(50, 230); // Adjusted for rotated display
display.print("Lake Under House");
display.setCursor(200, 280); // Adjusted for rotated display
display.print(lakeTempUnderAvg, 1);
display.print(" F");
display.setCursor(50, 340); // Adjusted for rotated display
display.print("Data Last Reported");
display.setCursor(200, 390); // Adjusted for rotated display
display.print(textData);
//wait for 10 seconds before updating again
delay(10000);
}
}
//Code sourced from ThingSpeak and GigaDisplay libraries.Matlab Visualization Code (works properly)
My first 3 lines of information display properly on my giga display shield.
The 4th line which is supposed to be a timestamp stored in my field as text (ex:
Displays as -1, not the text timestamp I am looking for. Any help is appreciated.
% Read the last entry and its timestamp
[data, timestamps] = thingSpeakRead(x, ‘NumPoints’, 1);
% Add a timezone offset of 5 hours
localTime = timestamps – hours(5);
% Display the local timestamp as text
text(0.5, 0.5, datestr(localTime), ‘FontSize’, 20, ‘HorizontalAlignment’, ‘center’);
axis off;
Note – sensitive info replaced with X
Arduino code
#include <WiFi.h> //library for connecting to WiFi
#include <ThingSpeak.h> //library for reading data from ThingSpeak
#include "Arduino_GigaDisplay_GFX.h" //library for using the GigaDisplay shield
//define WiFi credentials
const char* ssid = "x";
const char* password = "x";
WiFiClient client;
String textData = "";
//define ThingSpeak channel IDs and read APIs
unsigned long lakeChannelID = x;
const char* lakeReadAPI = "x";
//define GigaDisplay object
GigaDisplay_GFX display;
#define BLACK 0x0000
#define WHITE 0xFFFF
#define NEW 0xFF6B35
void setup() {
//initialize serial communication for debugging
Serial.begin(9600);
//connect to WiFi
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi…");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected!");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client); // Initialize ThingSpeak
display.begin();
}
void loop() {
float homeTemp = ThingSpeak.readFloatField(lakeChannelID, 8, lakeReadAPI);
float lakeTemp1 = ThingSpeak.readFloatField(lakeChannelID, 1, lakeReadAPI);
float lakeTemp2 = ThingSpeak.readFloatField(lakeChannelID, 2, lakeReadAPI);
float lakeTemp3 = ThingSpeak.readFloatField(lakeChannelID, 3, lakeReadAPI);
float lakeTemp4 = ThingSpeak.readFloatField(lakeChannelID, 4, lakeReadAPI);
float lakeTemp5 = ThingSpeak.readFloatField(lakeChannelID, 5, lakeReadAPI);
float lakeTemp6 = ThingSpeak.readFloatField(lakeChannelID, 6, lakeReadAPI);
String textData = ThingSpeak.readStringField(lakeChannelID,7, lakeReadAPI);
float lakeTempOutAvg = (lakeTemp1 + lakeTemp2 + lakeTemp3)/3;
float lakeTempUnderAvg = (lakeTemp4 + lakeTemp5 + lakeTemp6)/3;
long statuscode = ThingSpeak.getLastReadStatus();
if (statuscode == 200)
{
//print temperature data to serial monitor for debugging
Serial.print("Home Outside Temp: ");
Serial.println(homeTemp);
Serial.print("Lake Outside Temp: ");
Serial.println(lakeTemp1);
Serial.print("Lake Outside Average: ");
Serial.println(lakeTempOutAvg);
Serial.print("Lake Under Average: ");
Serial.println(lakeTempUnderAvg);
Serial.print("Last Read: ");
Serial.println(textData);
//clear display and set cursor to top left corner
display.setRotation(1); // -90 degrees rotation
display.fillScreen(BLACK);
display.setTextColor(NEW);
display.setTextSize( 5);
display.setCursor(50, 10); // Adjusted for rotated display
display.print("Home Outdoors");
display.setCursor(200, 60); // Adjusted for rotated display
display.print(homeTemp, 1);
display.print(" F");
display.setCursor(50, 120); // Adjusted for rotated display
display.print("Lake Outdoors");
display.setCursor(200, 170); // Adjusted for rotated display
display.print(lakeTempOutAvg, 1);
display.print(" F");
display.setCursor(50, 230); // Adjusted for rotated display
display.print("Lake Under House");
display.setCursor(200, 280); // Adjusted for rotated display
display.print(lakeTempUnderAvg, 1);
display.print(" F");
display.setCursor(50, 340); // Adjusted for rotated display
display.print("Data Last Reported");
display.setCursor(200, 390); // Adjusted for rotated display
display.print(textData);
//wait for 10 seconds before updating again
delay(10000);
}
}
//Code sourced from ThingSpeak and GigaDisplay libraries. Matlab Visualization Code (works properly)
My first 3 lines of information display properly on my giga display shield.
The 4th line which is supposed to be a timestamp stored in my field as text (ex:
Displays as -1, not the text timestamp I am looking for. Any help is appreciated.
% Read the last entry and its timestamp
[data, timestamps] = thingSpeakRead(x, ‘NumPoints’, 1);
% Add a timezone offset of 5 hours
localTime = timestamps – hours(5);
% Display the local timestamp as text
text(0.5, 0.5, datestr(localTime), ‘FontSize’, 20, ‘HorizontalAlignment’, ‘center’);
axis off;
Note – sensitive info replaced with X
Arduino code
#include <WiFi.h> //library for connecting to WiFi
#include <ThingSpeak.h> //library for reading data from ThingSpeak
#include "Arduino_GigaDisplay_GFX.h" //library for using the GigaDisplay shield
//define WiFi credentials
const char* ssid = "x";
const char* password = "x";
WiFiClient client;
String textData = "";
//define ThingSpeak channel IDs and read APIs
unsigned long lakeChannelID = x;
const char* lakeReadAPI = "x";
//define GigaDisplay object
GigaDisplay_GFX display;
#define BLACK 0x0000
#define WHITE 0xFFFF
#define NEW 0xFF6B35
void setup() {
//initialize serial communication for debugging
Serial.begin(9600);
//connect to WiFi
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi…");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected!");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
ThingSpeak.begin(client); // Initialize ThingSpeak
display.begin();
}
void loop() {
float homeTemp = ThingSpeak.readFloatField(lakeChannelID, 8, lakeReadAPI);
float lakeTemp1 = ThingSpeak.readFloatField(lakeChannelID, 1, lakeReadAPI);
float lakeTemp2 = ThingSpeak.readFloatField(lakeChannelID, 2, lakeReadAPI);
float lakeTemp3 = ThingSpeak.readFloatField(lakeChannelID, 3, lakeReadAPI);
float lakeTemp4 = ThingSpeak.readFloatField(lakeChannelID, 4, lakeReadAPI);
float lakeTemp5 = ThingSpeak.readFloatField(lakeChannelID, 5, lakeReadAPI);
float lakeTemp6 = ThingSpeak.readFloatField(lakeChannelID, 6, lakeReadAPI);
String textData = ThingSpeak.readStringField(lakeChannelID,7, lakeReadAPI);
float lakeTempOutAvg = (lakeTemp1 + lakeTemp2 + lakeTemp3)/3;
float lakeTempUnderAvg = (lakeTemp4 + lakeTemp5 + lakeTemp6)/3;
long statuscode = ThingSpeak.getLastReadStatus();
if (statuscode == 200)
{
//print temperature data to serial monitor for debugging
Serial.print("Home Outside Temp: ");
Serial.println(homeTemp);
Serial.print("Lake Outside Temp: ");
Serial.println(lakeTemp1);
Serial.print("Lake Outside Average: ");
Serial.println(lakeTempOutAvg);
Serial.print("Lake Under Average: ");
Serial.println(lakeTempUnderAvg);
Serial.print("Last Read: ");
Serial.println(textData);
//clear display and set cursor to top left corner
display.setRotation(1); // -90 degrees rotation
display.fillScreen(BLACK);
display.setTextColor(NEW);
display.setTextSize( 5);
display.setCursor(50, 10); // Adjusted for rotated display
display.print("Home Outdoors");
display.setCursor(200, 60); // Adjusted for rotated display
display.print(homeTemp, 1);
display.print(" F");
display.setCursor(50, 120); // Adjusted for rotated display
display.print("Lake Outdoors");
display.setCursor(200, 170); // Adjusted for rotated display
display.print(lakeTempOutAvg, 1);
display.print(" F");
display.setCursor(50, 230); // Adjusted for rotated display
display.print("Lake Under House");
display.setCursor(200, 280); // Adjusted for rotated display
display.print(lakeTempUnderAvg, 1);
display.print(" F");
display.setCursor(50, 340); // Adjusted for rotated display
display.print("Data Last Reported");
display.setCursor(200, 390); // Adjusted for rotated display
display.print(textData);
//wait for 10 seconds before updating again
delay(10000);
}
}
//Code sourced from ThingSpeak and GigaDisplay libraries. thingspeak, arduino MATLAB Answers — New Questions
Why Doesn’t pwelch with the ‘centered’ Option Follow the Same Convention as fftshift for Even nfft?
When the fft length is even, fftshift flips the input so that the Nyquist point is to the left. But pwelch with freqrange = ‘centered’ keeps the Nyquist point on the right.
The behavior in pwelch is documented, so can’t complain.
Just wondering why the developers might have made that choice for pwelch (and others, like periodogram), rather than maintaining consistency.
rng(100);
x = rand(1,10);
X = fftshift(fft(x));
% this usage of pwelch is undocumented because noverlap is supposed to be
% a positive integer
[P,f] = pwelch(x,ones(size(x)),0,10,1,’centered’);
figure
plot(f,P*10,’-o’,(-5:4)/10,X.*conj(X),’-x’)
axis paddedWhen the fft length is even, fftshift flips the input so that the Nyquist point is to the left. But pwelch with freqrange = ‘centered’ keeps the Nyquist point on the right.
The behavior in pwelch is documented, so can’t complain.
Just wondering why the developers might have made that choice for pwelch (and others, like periodogram), rather than maintaining consistency.
rng(100);
x = rand(1,10);
X = fftshift(fft(x));
% this usage of pwelch is undocumented because noverlap is supposed to be
% a positive integer
[P,f] = pwelch(x,ones(size(x)),0,10,1,’centered’);
figure
plot(f,P*10,’-o’,(-5:4)/10,X.*conj(X),’-x’)
axis padded When the fft length is even, fftshift flips the input so that the Nyquist point is to the left. But pwelch with freqrange = ‘centered’ keeps the Nyquist point on the right.
The behavior in pwelch is documented, so can’t complain.
Just wondering why the developers might have made that choice for pwelch (and others, like periodogram), rather than maintaining consistency.
rng(100);
x = rand(1,10);
X = fftshift(fft(x));
% this usage of pwelch is undocumented because noverlap is supposed to be
% a positive integer
[P,f] = pwelch(x,ones(size(x)),0,10,1,’centered’);
figure
plot(f,P*10,’-o’,(-5:4)/10,X.*conj(X),’-x’)
axis padded pwelch, fftshift, centered MATLAB Answers — New Questions
Why do my calculations not match up with the simulation results?
Hello,
For one of my university project we are tasked with designing a suspension system. Using hand calculations I have worked out that the maximum displacement of the mass should be 19.5mm when the spring stiffness is 54772.5N/m and the damping ratio is 3462.78N/(m/s). However, when I am modelling this system on simscape I get a displacement of around 200mm. I am new to using this software so suggestions as to where I’m going wrong would be great.
Below is the setup I’m trying to model where v=13.33m/s , go=0.015m and d=5m
This is the setup I’ve been using on simscapeHello,
For one of my university project we are tasked with designing a suspension system. Using hand calculations I have worked out that the maximum displacement of the mass should be 19.5mm when the spring stiffness is 54772.5N/m and the damping ratio is 3462.78N/(m/s). However, when I am modelling this system on simscape I get a displacement of around 200mm. I am new to using this software so suggestions as to where I’m going wrong would be great.
Below is the setup I’m trying to model where v=13.33m/s , go=0.015m and d=5m
This is the setup I’ve been using on simscape Hello,
For one of my university project we are tasked with designing a suspension system. Using hand calculations I have worked out that the maximum displacement of the mass should be 19.5mm when the spring stiffness is 54772.5N/m and the damping ratio is 3462.78N/(m/s). However, when I am modelling this system on simscape I get a displacement of around 200mm. I am new to using this software so suggestions as to where I’m going wrong would be great.
Below is the setup I’m trying to model where v=13.33m/s , go=0.015m and d=5m
This is the setup I’ve been using on simscape suspension, displacement, simscape, mass, damper, spring MATLAB Answers — New Questions
vehicle dynamics code problems
says t isn’t defined and gives me a hard time. Where t is the time component of the function.
%%VEHICLE_MODEL IDNLGREY model file
%%function [dx,y] = VEHICLE_MODEL(t, x, u, m, a, b, Cy, varargin)
function [dx,y] = VEHICLE_MODEL_test(t, x, u, m, a, b, Cy, varargin)
%% prompt = ‘Please enter the intial start time. ‘;
%% t = input(prompt);
%% prompt = ‘Please enter the Vehicle Mass in Kg ‘;
%% m = input(prompt);
% function parameters:
% t: the current time
% x: the state vector at time t
% u: the input vector at time t
% m: mass of the vehicle [kg]
% a: distance from front axle to COG [m]
% b: distance from rear axle to COG [m]
% Cy: lateral tire stiffness (Axis skew stiffness) [N/rad]
% varargin: optional inputs to the model file
J = m * 0.25 *(a+b)^2; % moment of inertia [kg*m^2]
Fyf = Cy*(u(1)-atan((x(4)+a*x(2))./x(3))); % lateral tire force on front tires [N]
Fyr = -Cy*atan((x(4)-b*x(2))./x(3)); % lateral tire force on rear tires [N]
vx_inertial = x(3).*cos(x(1))-x(4).*sin(x(1)); % longitudinal velocity in inertial reference frame [m/s]
vy_inertial = x(3).*sin(x(1))+x(4).*cos(x(1)); % lateral velocity in inertial reference frame [m/s]
% state equations.
dx = [x(2); … % yaw angle velocity [rad/s]
1/J*(a*(u(2)*sin(u(1))+Fyf*cos(u(1)))-b*Fyr); … % yaw angle accel. [rad/s^2]
1/m*(u(2)*cos(u(1))-Fyf*sin(u(1))+u(3))+x(4).*x(2); … % longitudinal accel. in body reference frame [m/s^2]
1/m*(u(2)*sin(u(1))+Fyf*cos(u(1))+Fyr)-x(3).*x(2); … % lateral accel. in body reference frame [m/s^2]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial … % lateral velocity in inertial reference frame [m/s]
];
% output equations.
y = [x(1); … % yaw angle [rad]
x(2); … % yaw angle velocity [rad/s]
x(3); … % longitudinal velocity in body reference frame [m/s]
x(4); … % lateral velocity in body reference frame [m/s]
x(5); … % longitudinal position in inertial reference frame [m]
x(6); … % lateral position in inertial reference frame [m]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial; … % lateral velocity in inertial reference frame [m/s]
Fyf; … % lateral tire force on front tires [N]
Fyr … % lateral tire force on rear tires [N]
];
endsays t isn’t defined and gives me a hard time. Where t is the time component of the function.
%%VEHICLE_MODEL IDNLGREY model file
%%function [dx,y] = VEHICLE_MODEL(t, x, u, m, a, b, Cy, varargin)
function [dx,y] = VEHICLE_MODEL_test(t, x, u, m, a, b, Cy, varargin)
%% prompt = ‘Please enter the intial start time. ‘;
%% t = input(prompt);
%% prompt = ‘Please enter the Vehicle Mass in Kg ‘;
%% m = input(prompt);
% function parameters:
% t: the current time
% x: the state vector at time t
% u: the input vector at time t
% m: mass of the vehicle [kg]
% a: distance from front axle to COG [m]
% b: distance from rear axle to COG [m]
% Cy: lateral tire stiffness (Axis skew stiffness) [N/rad]
% varargin: optional inputs to the model file
J = m * 0.25 *(a+b)^2; % moment of inertia [kg*m^2]
Fyf = Cy*(u(1)-atan((x(4)+a*x(2))./x(3))); % lateral tire force on front tires [N]
Fyr = -Cy*atan((x(4)-b*x(2))./x(3)); % lateral tire force on rear tires [N]
vx_inertial = x(3).*cos(x(1))-x(4).*sin(x(1)); % longitudinal velocity in inertial reference frame [m/s]
vy_inertial = x(3).*sin(x(1))+x(4).*cos(x(1)); % lateral velocity in inertial reference frame [m/s]
% state equations.
dx = [x(2); … % yaw angle velocity [rad/s]
1/J*(a*(u(2)*sin(u(1))+Fyf*cos(u(1)))-b*Fyr); … % yaw angle accel. [rad/s^2]
1/m*(u(2)*cos(u(1))-Fyf*sin(u(1))+u(3))+x(4).*x(2); … % longitudinal accel. in body reference frame [m/s^2]
1/m*(u(2)*sin(u(1))+Fyf*cos(u(1))+Fyr)-x(3).*x(2); … % lateral accel. in body reference frame [m/s^2]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial … % lateral velocity in inertial reference frame [m/s]
];
% output equations.
y = [x(1); … % yaw angle [rad]
x(2); … % yaw angle velocity [rad/s]
x(3); … % longitudinal velocity in body reference frame [m/s]
x(4); … % lateral velocity in body reference frame [m/s]
x(5); … % longitudinal position in inertial reference frame [m]
x(6); … % lateral position in inertial reference frame [m]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial; … % lateral velocity in inertial reference frame [m/s]
Fyf; … % lateral tire force on front tires [N]
Fyr … % lateral tire force on rear tires [N]
];
end says t isn’t defined and gives me a hard time. Where t is the time component of the function.
%%VEHICLE_MODEL IDNLGREY model file
%%function [dx,y] = VEHICLE_MODEL(t, x, u, m, a, b, Cy, varargin)
function [dx,y] = VEHICLE_MODEL_test(t, x, u, m, a, b, Cy, varargin)
%% prompt = ‘Please enter the intial start time. ‘;
%% t = input(prompt);
%% prompt = ‘Please enter the Vehicle Mass in Kg ‘;
%% m = input(prompt);
% function parameters:
% t: the current time
% x: the state vector at time t
% u: the input vector at time t
% m: mass of the vehicle [kg]
% a: distance from front axle to COG [m]
% b: distance from rear axle to COG [m]
% Cy: lateral tire stiffness (Axis skew stiffness) [N/rad]
% varargin: optional inputs to the model file
J = m * 0.25 *(a+b)^2; % moment of inertia [kg*m^2]
Fyf = Cy*(u(1)-atan((x(4)+a*x(2))./x(3))); % lateral tire force on front tires [N]
Fyr = -Cy*atan((x(4)-b*x(2))./x(3)); % lateral tire force on rear tires [N]
vx_inertial = x(3).*cos(x(1))-x(4).*sin(x(1)); % longitudinal velocity in inertial reference frame [m/s]
vy_inertial = x(3).*sin(x(1))+x(4).*cos(x(1)); % lateral velocity in inertial reference frame [m/s]
% state equations.
dx = [x(2); … % yaw angle velocity [rad/s]
1/J*(a*(u(2)*sin(u(1))+Fyf*cos(u(1)))-b*Fyr); … % yaw angle accel. [rad/s^2]
1/m*(u(2)*cos(u(1))-Fyf*sin(u(1))+u(3))+x(4).*x(2); … % longitudinal accel. in body reference frame [m/s^2]
1/m*(u(2)*sin(u(1))+Fyf*cos(u(1))+Fyr)-x(3).*x(2); … % lateral accel. in body reference frame [m/s^2]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial … % lateral velocity in inertial reference frame [m/s]
];
% output equations.
y = [x(1); … % yaw angle [rad]
x(2); … % yaw angle velocity [rad/s]
x(3); … % longitudinal velocity in body reference frame [m/s]
x(4); … % lateral velocity in body reference frame [m/s]
x(5); … % longitudinal position in inertial reference frame [m]
x(6); … % lateral position in inertial reference frame [m]
vx_inertial; … % longitudinal velocity in inertial reference frame [m/s]
vy_inertial; … % lateral velocity in inertial reference frame [m/s]
Fyf; … % lateral tire force on front tires [N]
Fyr … % lateral tire force on rear tires [N]
];
end matlab function MATLAB Answers — New Questions
Generated “*.m” file could not be real time updated
hello:
As showed in figure. I have a ‘main.m’ file, which feature is read external files and generate ‘a.m’ file, then run ‘a.m’. I found that, after run(‘a.m’) on ‘Step 2’, the resault represent that ‘a.m’ is not newest. After run ‘main.m’, when I check ‘a.m’, it is newest.
My question is there any way to run newest ‘a.m’ in ‘main.m’.
Thank you.hello:
As showed in figure. I have a ‘main.m’ file, which feature is read external files and generate ‘a.m’ file, then run ‘a.m’. I found that, after run(‘a.m’) on ‘Step 2’, the resault represent that ‘a.m’ is not newest. After run ‘main.m’, when I check ‘a.m’, it is newest.
My question is there any way to run newest ‘a.m’ in ‘main.m’.
Thank you. hello:
As showed in figure. I have a ‘main.m’ file, which feature is read external files and generate ‘a.m’ file, then run ‘a.m’. I found that, after run(‘a.m’) on ‘Step 2’, the resault represent that ‘a.m’ is not newest. After run ‘main.m’, when I check ‘a.m’, it is newest.
My question is there any way to run newest ‘a.m’ in ‘main.m’.
Thank you. file MATLAB Answers — New Questions
PMSM FOC Hall sensor input for custom GPIO pin configurations
Hello Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for one of my PMSM control using FOC with Hall sensor for my custom board with TI F280049C and TI DRV8350 board. My custom board have fixed Hall sensor input cofigured at GPIO29, GPIO30,GPIO31. Below are my quires.
As these example have Hall sensor input captured using ECAP module. How to change GPIO for Hall sensor input in same model using ECAP?
How to check hall commutation sequence in model simulation and in hardware?
As above example uses DRV8305, I need to use DRV8350,what changes need to do in model?
Awaiting for valuable response.
Thanks.Hello Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for one of my PMSM control using FOC with Hall sensor for my custom board with TI F280049C and TI DRV8350 board. My custom board have fixed Hall sensor input cofigured at GPIO29, GPIO30,GPIO31. Below are my quires.
As these example have Hall sensor input captured using ECAP module. How to change GPIO for Hall sensor input in same model using ECAP?
How to check hall commutation sequence in model simulation and in hardware?
As above example uses DRV8305, I need to use DRV8350,what changes need to do in model?
Awaiting for valuable response.
Thanks. Hello Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for one of my PMSM control using FOC with Hall sensor for my custom board with TI F280049C and TI DRV8350 board. My custom board have fixed Hall sensor input cofigured at GPIO29, GPIO30,GPIO31. Below are my quires.
As these example have Hall sensor input captured using ECAP module. How to change GPIO for Hall sensor input in same model using ECAP?
How to check hall commutation sequence in model simulation and in hardware?
As above example uses DRV8305, I need to use DRV8350,what changes need to do in model?
Awaiting for valuable response.
Thanks. pmsm, foc, hallsensor, drv8350 MATLAB Answers — New Questions
code is running but nothing pops up in my workspace?
in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF);in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF); in my command window it says
lab4
Enter a score (-1 to stop):
ctA = 0; %fill this with the quantity of A grades
ctB = 0; %fill this with the quantity of B grades
ctC = 0; %fill this with the quantity of C grades
ctD = 0; %fill this with the quantity of D grades
ctF = 0; %fill this with the quantity of F grades
d = input(‘Enter a score (-1 to stop): ‘);
scores = []; %empty array where values are stored
while d ~= -1
scores = [scores d]
d = input(‘Enter a score (-1 to stop): ‘);
end
for i =1:length(scores) % length of value i
if (scores(i) >= 90) % input if value is less than or equal to 90
ctA = ctA + 1 % how many As
scores = [scores, i]; % store the # of As in to score
elseif (scores(i) >=80) %input if value is less than or equal to 80
ctB = ctB +1 % how many Bs
scores= [scores i]; %store the # of Bs in to score
elseif (scores(i) >=70) %input if value is less than or equal to 70
ctC = ctC + 1 % how many Cs
scores= [scores i]; %store the # of Cs in to score
elseif (scores(i) >=60) %input if value is less than or equal to 60
ctD = ctD + 1
scores= [scores i];
elseif (scores(i) <60)
ctF = ctF + 1
scores= [scores i];
end
end
%displaying grades
disp("# of As: " + ctA);
disp("# of Bs: " + ctB);
disp("# of Cs: " + ctC);
disp("# of Ds: " + ctD);
disp("# of Fs: " + ctF); workspace MATLAB Answers — New Questions
Matlab’s new appearance after R2025a hinders its usability.
Hello,
As we know, Matlab kept its appearance (or user interface) pretty much the same till R2024b version. As we know, from R2025a onwards, there was a major change, and I tried to avoid both R2025a and R2025b versions. At the same time, there were some essential functionalities of these versions, and I now have to use both R2025b and R2024b.
The major problem for me is this: I created a dark mode in R2024b (I also use it for let’s say 10 years), it may look like the dark mode in later releases, but I cannot directly control the colors of some objects, for example, the variable windows text color is fixed, I believe. The appearance of the figures is also different; overall, the sizes of the logos and buttons seem a bit different. When I see all these small details, frankly, it doesn’t look like/feel like the Matlab I’ve been using for so many years. (So it is a serious distraction source, at least for me, and I cannot fix it.
My question/request would be a simple one: would it be possible to bring the old skin of Matlab back? I would be so grateful.
Regards
DenizHello,
As we know, Matlab kept its appearance (or user interface) pretty much the same till R2024b version. As we know, from R2025a onwards, there was a major change, and I tried to avoid both R2025a and R2025b versions. At the same time, there were some essential functionalities of these versions, and I now have to use both R2025b and R2024b.
The major problem for me is this: I created a dark mode in R2024b (I also use it for let’s say 10 years), it may look like the dark mode in later releases, but I cannot directly control the colors of some objects, for example, the variable windows text color is fixed, I believe. The appearance of the figures is also different; overall, the sizes of the logos and buttons seem a bit different. When I see all these small details, frankly, it doesn’t look like/feel like the Matlab I’ve been using for so many years. (So it is a serious distraction source, at least for me, and I cannot fix it.
My question/request would be a simple one: would it be possible to bring the old skin of Matlab back? I would be so grateful.
Regards
Deniz Hello,
As we know, Matlab kept its appearance (or user interface) pretty much the same till R2024b version. As we know, from R2025a onwards, there was a major change, and I tried to avoid both R2025a and R2025b versions. At the same time, there were some essential functionalities of these versions, and I now have to use both R2025b and R2024b.
The major problem for me is this: I created a dark mode in R2024b (I also use it for let’s say 10 years), it may look like the dark mode in later releases, but I cannot directly control the colors of some objects, for example, the variable windows text color is fixed, I believe. The appearance of the figures is also different; overall, the sizes of the logos and buttons seem a bit different. When I see all these small details, frankly, it doesn’t look like/feel like the Matlab I’ve been using for so many years. (So it is a serious distraction source, at least for me, and I cannot fix it.
My question/request would be a simple one: would it be possible to bring the old skin of Matlab back? I would be so grateful.
Regards
Deniz matlab, color MATLAB Answers — New Questions
How can I configure a dataset that I have found online to be used for training a neural network for battery state of charge estimation?
I am working on a project for university in which I have to create a machine learning model for battery state of charge estimation. Per my supervisors recommendation I have settled on using a neural network, but was told that I cannot use the example datasets found on MATLAB and that I must find one online from industry. I have found a dataset that seems like it would be suitable for my project but I am not sure how to use this dataset within MATLAB. The dataset is from Technische Universität Berlin, found at the link https://depositonce.tu-berlin.de/items/7f68932b-4d43-4f49-a5d8-914b00039f87 , and all of the data is found within excel files. To create my neural network model I have been following the guide on the mathswork/MATLAB website but the example uses data that comes atatched as supporting files and does not show how to get my own data. The link for the guide I have been following is https://uk.mathworks.com/help/deeplearning/ug/prepare-data-for-battery-state-of-charge-estimation.html . Here the training data for the 4 different temperatures is simply loaded so I was wondering could I use these same lines but change the file name to the excel files for the different temperatures and also just load them, or are more steps involved? Any advice or resources that may help me would be appreciated as I am quite stumped at the moment.I am working on a project for university in which I have to create a machine learning model for battery state of charge estimation. Per my supervisors recommendation I have settled on using a neural network, but was told that I cannot use the example datasets found on MATLAB and that I must find one online from industry. I have found a dataset that seems like it would be suitable for my project but I am not sure how to use this dataset within MATLAB. The dataset is from Technische Universität Berlin, found at the link https://depositonce.tu-berlin.de/items/7f68932b-4d43-4f49-a5d8-914b00039f87 , and all of the data is found within excel files. To create my neural network model I have been following the guide on the mathswork/MATLAB website but the example uses data that comes atatched as supporting files and does not show how to get my own data. The link for the guide I have been following is https://uk.mathworks.com/help/deeplearning/ug/prepare-data-for-battery-state-of-charge-estimation.html . Here the training data for the 4 different temperatures is simply loaded so I was wondering could I use these same lines but change the file name to the excel files for the different temperatures and also just load them, or are more steps involved? Any advice or resources that may help me would be appreciated as I am quite stumped at the moment. I am working on a project for university in which I have to create a machine learning model for battery state of charge estimation. Per my supervisors recommendation I have settled on using a neural network, but was told that I cannot use the example datasets found on MATLAB and that I must find one online from industry. I have found a dataset that seems like it would be suitable for my project but I am not sure how to use this dataset within MATLAB. The dataset is from Technische Universität Berlin, found at the link https://depositonce.tu-berlin.de/items/7f68932b-4d43-4f49-a5d8-914b00039f87 , and all of the data is found within excel files. To create my neural network model I have been following the guide on the mathswork/MATLAB website but the example uses data that comes atatched as supporting files and does not show how to get my own data. The link for the guide I have been following is https://uk.mathworks.com/help/deeplearning/ug/prepare-data-for-battery-state-of-charge-estimation.html . Here the training data for the 4 different temperatures is simply loaded so I was wondering could I use these same lines but change the file name to the excel files for the different temperatures and also just load them, or are more steps involved? Any advice or resources that may help me would be appreciated as I am quite stumped at the moment. machine-learning, neural network, dataset, importing excel data, data import, data acquisition, battery, state-of-charge estimation, soc estimation, soc, state-of-charge MATLAB Answers — New Questions
Can the Import Tool dialog box (when closing) be disabled
Is there a way to diable the promt asking to confirm closing files in the Import Tool?
This is a new feature (probably from 2024). If I have multiple files open in the Import Tools (in different tabs) and I close the Tool (click the X) a dialog box appears for every single file asking to confirm.
I couldn’t find any way to disable this, and when I have many files open this becomes very tedious.Is there a way to diable the promt asking to confirm closing files in the Import Tool?
This is a new feature (probably from 2024). If I have multiple files open in the Import Tools (in different tabs) and I close the Tool (click the X) a dialog box appears for every single file asking to confirm.
I couldn’t find any way to disable this, and when I have many files open this becomes very tedious. Is there a way to diable the promt asking to confirm closing files in the Import Tool?
This is a new feature (probably from 2024). If I have multiple files open in the Import Tools (in different tabs) and I close the Tool (click the X) a dialog box appears for every single file asking to confirm.
I couldn’t find any way to disable this, and when I have many files open this becomes very tedious. import tool, dialog, close file MATLAB Answers — New Questions
Should Unity Value be Displayed when Multiplied by a symunit?
The following results look peculiar IMO. Shouldn’t a unit always be preceded by a value? I’ve never seen this convention before.
u = symunit;
mps = u.meter/u.sec;
x = 1*mps
x = reshape(1:4,2,2)*mpsThe following results look peculiar IMO. Shouldn’t a unit always be preceded by a value? I’ve never seen this convention before.
u = symunit;
mps = u.meter/u.sec;
x = 1*mps
x = reshape(1:4,2,2)*mps The following results look peculiar IMO. Shouldn’t a unit always be preceded by a value? I’ve never seen this convention before.
u = symunit;
mps = u.meter/u.sec;
x = 1*mps
x = reshape(1:4,2,2)*mps sympolic, unit MATLAB Answers — New Questions
When I use nlinfit, the sintax nlinfit(t0,p0 ,@(b,t) …),but if Ireplace nlinfit with fmincon, the sintax is not valid, why?
When I use nlinfit, the sintax nlinfit(t0,p0 ,@(b,t) …) works, but if Ireplace nlinfit with fmincon, the sintax is not valid, why?When I use nlinfit, the sintax nlinfit(t0,p0 ,@(b,t) …) works, but if Ireplace nlinfit with fmincon, the sintax is not valid, why? When I use nlinfit, the sintax nlinfit(t0,p0 ,@(b,t) …) works, but if Ireplace nlinfit with fmincon, the sintax is not valid, why? transferred MATLAB Answers — New Questions
parfor loop error with plotting on an image
Hello, I have an image that I want to perform some analysis in regions using the parallel toolbox. To begin with I just want to visualise each region to ensure its correct first and have done this basic parfor loop
parfor i=1:10
plot(ax,xl+250,i*250,’c.’,’Markersize’,20);
% later do some analysis
end
But Im getting this error:
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Any suggestions please.Hello, I have an image that I want to perform some analysis in regions using the parallel toolbox. To begin with I just want to visualise each region to ensure its correct first and have done this basic parfor loop
parfor i=1:10
plot(ax,xl+250,i*250,’c.’,’Markersize’,20);
% later do some analysis
end
But Im getting this error:
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Any suggestions please. Hello, I have an image that I want to perform some analysis in regions using the parallel toolbox. To begin with I just want to visualise each region to ensure its correct first and have done this basic parfor loop
parfor i=1:10
plot(ax,xl+250,i*250,’c.’,’Markersize’,20);
% later do some analysis
end
But Im getting this error:
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: While loading an object of class ‘HTS_TestSoftware’:
Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
> In matlab.ui.control.UIAxes.convertAxes
In matlab.ui.control/UIAxes/convertToAxes
In matlab.ui.control/UIAxes/get.Axes
In parallel.internal.pool.optionallySerialize (line 10)
In parallel.internal.parfor/ParforEngine/buildParforController (line 111)
In parallel.internal.parfor/ParforEngine (line 81)
In parallel.parfor/PoolOptions/createEngine (line 32)
In parallel_function>@(initData,F)createEngine(M,initData,F,N) (line 442)
In parallel_function (line 459)
In HTS_TestSoftware/testButtonPushed (line 26748)
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
Any suggestions please. parfor, plot, ax MATLAB Answers — New Questions
Adding a single left bracket and a single right bracket to a matrix
I want the following:
I get the following:
k = 13;
disp([‘Number of neutral strand = ‘ num2str(k)])
Rb = 1.269/2/12; % ft
disp([‘Radius of the circle passing through the centers of the neutral strands, Rb = ‘ num2str(Rb) ‘ ft’])
RDc = 0.498/2/12; % ft
disp([‘Phase conductor equivalent (self) radius, RDc = ‘ num2str(RDc) ‘ ft’])
RDs = 0.1019/2/12; % ft
disp([‘Neutral strand equivalent radius, RDs = ‘ num2str(RDs) ‘ ft’])
yag = (77.3619i)/(log(Rb/RDc)-(1/k)*(log(k*(RDs/Rb)))); %μS/mile
disp([‘Shunt admittance, yag = ‘ num2str(yag) ‘ μS/mile’])
Yabc = diag([yag,yag,yag]);
disp(Yabc)
temp = splitlines(formattedDisplayText(Yabc));
temp(2) = temp(2) + " μS/mile";
disp(char(temp))I want the following:
I get the following:
k = 13;
disp([‘Number of neutral strand = ‘ num2str(k)])
Rb = 1.269/2/12; % ft
disp([‘Radius of the circle passing through the centers of the neutral strands, Rb = ‘ num2str(Rb) ‘ ft’])
RDc = 0.498/2/12; % ft
disp([‘Phase conductor equivalent (self) radius, RDc = ‘ num2str(RDc) ‘ ft’])
RDs = 0.1019/2/12; % ft
disp([‘Neutral strand equivalent radius, RDs = ‘ num2str(RDs) ‘ ft’])
yag = (77.3619i)/(log(Rb/RDc)-(1/k)*(log(k*(RDs/Rb)))); %μS/mile
disp([‘Shunt admittance, yag = ‘ num2str(yag) ‘ μS/mile’])
Yabc = diag([yag,yag,yag]);
disp(Yabc)
temp = splitlines(formattedDisplayText(Yabc));
temp(2) = temp(2) + " μS/mile";
disp(char(temp)) I want the following:
I get the following:
k = 13;
disp([‘Number of neutral strand = ‘ num2str(k)])
Rb = 1.269/2/12; % ft
disp([‘Radius of the circle passing through the centers of the neutral strands, Rb = ‘ num2str(Rb) ‘ ft’])
RDc = 0.498/2/12; % ft
disp([‘Phase conductor equivalent (self) radius, RDc = ‘ num2str(RDc) ‘ ft’])
RDs = 0.1019/2/12; % ft
disp([‘Neutral strand equivalent radius, RDs = ‘ num2str(RDs) ‘ ft’])
yag = (77.3619i)/(log(Rb/RDc)-(1/k)*(log(k*(RDs/Rb)))); %μS/mile
disp([‘Shunt admittance, yag = ‘ num2str(yag) ‘ μS/mile’])
Yabc = diag([yag,yag,yag]);
disp(Yabc)
temp = splitlines(formattedDisplayText(Yabc));
temp(2) = temp(2) + " μS/mile";
disp(char(temp)) display brackets MATLAB Answers — New Questions
weird symbol mapping in OQPSK modulator
As I open the MATLAB’s OQPSK Modulator Baseband block (via Look Under Mask), there is a weird symbol mapping inside as this:
for binary symbol mapping: (0,1,2,3) –> (3,1,0,2)
for gray symbol mapping: (0,1,2,3) –> (3,1,2,0)
both are not any standard mappings nor differential! I wonder why?As I open the MATLAB’s OQPSK Modulator Baseband block (via Look Under Mask), there is a weird symbol mapping inside as this:
for binary symbol mapping: (0,1,2,3) –> (3,1,0,2)
for gray symbol mapping: (0,1,2,3) –> (3,1,2,0)
both are not any standard mappings nor differential! I wonder why? As I open the MATLAB’s OQPSK Modulator Baseband block (via Look Under Mask), there is a weird symbol mapping inside as this:
for binary symbol mapping: (0,1,2,3) –> (3,1,0,2)
for gray symbol mapping: (0,1,2,3) –> (3,1,2,0)
both are not any standard mappings nor differential! I wonder why? communication, modulation MATLAB Answers — New Questions
Why does pcolor not display the full matrix?
There are several questions on here asking why pcolor does not display the full matrix. Most answers say something along the lines of "use image/imagesc instead". And then other people jump in and say pcolor is more powerful (because it allows irregularly spaced grids). In my case, I use irregularly spaced grids to display geophysical modelling results so image/imagesc does not work. Some people suggest first interpolating your irregularly-spaced data and then using image/imagesc. But, for me, the actual x and y vectors matter a lot (e.g. the location of a given model cell is very important).
I understand that pcolor removes the right column and the top row.
My question is: Why does this happen? Is this a feature or a bug?
From the pcolor help:
"The grid covers the region X=1:n and Y=1:m, where [m,n] = size(C)."
Maybe I’m misunderstanding, but doesn’t the grid cover the region X = 1:n-1 and Y=1:m-1? Why does it say it covers the full region if, in reality, it cuts off the top row and right column of the data matrix?
To me this is a bug that should be fixed and everyone seems to complain about it. But I figure there must be some deeper reason why it is not (or can’t be) fixed.
Here’s an example script:
%Some irregularly spaced vectors:
x = [0.5 0.8 1 1.6];
y = [1.2 1.4 2 2.2];
%Some data
r = ones(4,4); %Size = 4 by 5
r(1,1) = 3;
r(4,4) = 10;
r(2,2) = 10;
pcolor(x,y,r)
colorbar
% r(2,2) is in the correct spot
% and you can see r(1,1) as well.
% But you cannot see r(4,4) = 10There are several questions on here asking why pcolor does not display the full matrix. Most answers say something along the lines of "use image/imagesc instead". And then other people jump in and say pcolor is more powerful (because it allows irregularly spaced grids). In my case, I use irregularly spaced grids to display geophysical modelling results so image/imagesc does not work. Some people suggest first interpolating your irregularly-spaced data and then using image/imagesc. But, for me, the actual x and y vectors matter a lot (e.g. the location of a given model cell is very important).
I understand that pcolor removes the right column and the top row.
My question is: Why does this happen? Is this a feature or a bug?
From the pcolor help:
"The grid covers the region X=1:n and Y=1:m, where [m,n] = size(C)."
Maybe I’m misunderstanding, but doesn’t the grid cover the region X = 1:n-1 and Y=1:m-1? Why does it say it covers the full region if, in reality, it cuts off the top row and right column of the data matrix?
To me this is a bug that should be fixed and everyone seems to complain about it. But I figure there must be some deeper reason why it is not (or can’t be) fixed.
Here’s an example script:
%Some irregularly spaced vectors:
x = [0.5 0.8 1 1.6];
y = [1.2 1.4 2 2.2];
%Some data
r = ones(4,4); %Size = 4 by 5
r(1,1) = 3;
r(4,4) = 10;
r(2,2) = 10;
pcolor(x,y,r)
colorbar
% r(2,2) is in the correct spot
% and you can see r(1,1) as well.
% But you cannot see r(4,4) = 10 There are several questions on here asking why pcolor does not display the full matrix. Most answers say something along the lines of "use image/imagesc instead". And then other people jump in and say pcolor is more powerful (because it allows irregularly spaced grids). In my case, I use irregularly spaced grids to display geophysical modelling results so image/imagesc does not work. Some people suggest first interpolating your irregularly-spaced data and then using image/imagesc. But, for me, the actual x and y vectors matter a lot (e.g. the location of a given model cell is very important).
I understand that pcolor removes the right column and the top row.
My question is: Why does this happen? Is this a feature or a bug?
From the pcolor help:
"The grid covers the region X=1:n and Y=1:m, where [m,n] = size(C)."
Maybe I’m misunderstanding, but doesn’t the grid cover the region X = 1:n-1 and Y=1:m-1? Why does it say it covers the full region if, in reality, it cuts off the top row and right column of the data matrix?
To me this is a bug that should be fixed and everyone seems to complain about it. But I figure there must be some deeper reason why it is not (or can’t be) fixed.
Here’s an example script:
%Some irregularly spaced vectors:
x = [0.5 0.8 1 1.6];
y = [1.2 1.4 2 2.2];
%Some data
r = ones(4,4); %Size = 4 by 5
r(1,1) = 3;
r(4,4) = 10;
r(2,2) = 10;
pcolor(x,y,r)
colorbar
% r(2,2) is in the correct spot
% and you can see r(1,1) as well.
% But you cannot see r(4,4) = 10 pcolor, plotting, grid MATLAB Answers — New Questions









